vikasskool / google-api-translate-java

Automatically exported from code.google.com/p/google-api-translate-java
0 stars 0 forks source link

Error When Calling Translate.execute #116

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. I am just calling the using the following program, but its throwing an Error 
2. It should just convert my String, its a simple program the Error is 
3. Exception in thread "main" java.lang.NoClassDefFoundError: 
org/json/JSONObject
    at com.google.api.GoogleAPI.retrieveJSON(GoogleAPI.java:122)
    at com.google.api.translate.Translate.execute(Translate.java:69)
    at translator.Translator.translate(Translator.java:12)
    at translator.Translator.main(Translator.java:17)
Process exited with exit code 1.
What is the expected output? What do you see instead?
Bonjour

What version of the product are you using? On what operating system?
Windows, Oracle JDEveloper 10.1.3.1

Please provide any additional information below.
package translator;

import com.google.api.translate.Language;
import com.google.api.translate.Translate;
public class Translator {
    public Translator() {
    }
    public String translate(String input, String fromLanguage, String toLanguage)
    throws Exception
    {
        Translate.setHttpReferrer(" asdf");
        return Translate.execute(input, Language.fromString(fromLanguage),  Language.fromString(toLanguage));
    }
  public static void main(String[] args) {
    try {
    Translator t = new Translator();
      String translatedText = t.translate("Good", "en","es");
      System.out.println(translatedText);
    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }
} 

Original issue reported on code.google.com by prashanth.balajapally on 25 Dec 2010 at 5:24

Attachments:

GoogleCodeExporter commented 9 years ago
You're missing the json.jar dependency, documented on the project home page:

http://code.google.com/p/google-api-translate-java/

Original comment by rich.mid...@gmail.com on 25 Dec 2010 at 8:27