Results 1 to 2 of 2
  1. #1
    ishi07 is offline Member
    Join Date
    May 2012
    Posts
    1
    Rep Power
    0

    Default Error: cannot find symbol

    Quote Originally Posted by dswastik View Post
    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

    Java 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......

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,188
    Rep Power
    19

    Default Re: Error: cannot find symbol

    Removed from Language translation

    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
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Cannot find symbol error
    By abdulahadone in forum New To Java
    Replies: 11
    Last Post: 03-23-2012, 11:45 AM
  2. Cannot find symbol error?
    By Josep_16 in forum New To Java
    Replies: 2
    Last Post: 06-19-2011, 07:14 PM
  3. Error: Cannot Find Symbol
    By mawright in forum New To Java
    Replies: 4
    Last Post: 04-14-2011, 02:41 PM
  4. error cannot find symbol
    By jcoon3 in forum New To Java
    Replies: 3
    Last Post: 09-27-2009, 10:56 PM
  5. Replies: 9
    Last Post: 10-18-2008, 08:26 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •