Error: cannot find symbol
Quote:
Originally Posted by
dswastik
Did you download both the jar files and set to classpath? Which program are you trying to run.
try the following code after setting the classpath
Code:
import com.google.api.translate.Language;
import com.google.api.translate.Translate;
public class Main {
public static void main(String[] args) throws Exception {
// Set the HTTP referrer to your website address.
Translate.setHttpReferrer("http://code.google.com/p/google-api-translate-java");
String translatedText = Translate.execute("Bonjour monde le",
Language.FRENCH, Language.ENGLISH);
System.out.println(translatedText);
}
}
when i tried to execute this code i am getting error...
Main.java:9: cannot find symbol
symbol : method setHttpReferrer(java.lang.String)
location: interface com.google.api.translate.Translate
Translate.setHttpReferrer("http://code.google.com/p/google-api-translate-jav
a");
^
Main.java:11: non-static method execute(java.lang.String,com.google.api.translat
e.Language,com.google.api.translate.Language) cannot be referenced from a static
context
String translatedText = Translate.execute("Bonjour monde le",Language.FRENCH
, Language.ENGLISH);
^
2 errors
i have set class path for google-api-translate-java-0.97.jar;.;
and when i am setting classpath for json-20090211.jar;.;
i am getting 7 errors.
please help me......
Re: Error: cannot find symbol
Removed from http://www.java-forums.org/java-appl...anslation.html
When you have a question, start your own thread. Don't post to an old dead thread and don't hijack another poster's thread.
As for your question, copying code without understanding the fundamentals of a programming language does not a program make. Start here: Lesson: The "Hello World!" Application (The Java™ Tutorials > Getting Started)
db