Results 1 to 8 of 8
  1. #1
    sanketroy is offline Member
    Join Date
    Oct 2012
    Posts
    4
    Rep Power
    0

    Default Gettin unkownHostException while trying to translate using microsoft translate API

    am writing a simple program to translate convert korean text entered to english i am using microsoft-translator-java-api-0.6.1-jar for tha. even tried it with google translate API and getting the same issue i.e. unkownHostException

    here is the servlet code of the post method

    [code]String koreanText=request.getParameter("koreanText");
    Java Code:
    System.out.println(koreanText);
             System.setProperty("http.proxyHost", "proxy");
             System.setProperty("http.proxyPort", "8080");  
             Translate.setClientId("client id"); 
             Translate.setClientSecret("client secret");
             System.out.println(Language.KOREAN);    
             System.out.println(koreanText);
             try {
                      [COLOR="#FF0000"]String translatedText = Translate.execute(koreanText, Language.KOREAN,
    Language.ENGLISH); [/COLOR]                 System.out.println(translatedText);  
             }
               catch (Exception e){   
          e.printStackTrace(); }
    Last edited by sanketroy; 10-04-2012 at 03:16 PM.

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,009
    Rep Power
    20

    Default Re: Gettin unkownHostException while trying to translate using microsoft translate AP

    Please use [code] tags [/code] when posting code.
    Many people won't bother reading unformatted code.

    Can you post the full exception and stack trace, and highlight where in your code it is occurring (presumably the bit in the **)?
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  3. #3
    sanketroy is offline Member
    Join Date
    Oct 2012
    Posts
    4
    Rep Power
    0

    Default Re: Gettin unkownHostException while trying to translate using microsoft translate AP

    i guess these lines would be usefull

    Error: [google-api-translate-java] Error retrieving translation.
    18:17:56,813 ERROR [STDERR] com.google.api.GoogleAPIException: java.lang.Exception: [google-api-translate-java] Error retrieving translation.

    18:17:56,844 ERROR [STDERR] Caused by: java.lang.Exception: [google-api-translate-java] Error retrieving translation.

    18:17:56,844 ERROR [STDERR] Caused by: java.net.UnknownHostException: www.googleapis.com

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,009
    Rep Power
    20

    Default Re: Gettin unkownHostException while trying to translate using microsoft translate AP

    Have you tried that address?
    I get 404.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  5. #5
    sanketroy is offline Member
    Join Date
    Oct 2012
    Posts
    4
    Rep Power
    0

    Default Re: Gettin unkownHostException while trying to translate using microsoft translate AP

    ya same here

    i tried to solve this issue in more or less every way i could find on web. tried 3-4 different APIs . everywhere the exception is the same

    tried it in this way too as posted in this forum Language translation
    with key and without key
    nothing works. same exception everytime

  6. #6
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,009
    Rep Power
    20

    Default Re: Gettin unkownHostException while trying to translate using microsoft translate AP

    And inside that thread they refer to:
    Java Code:
    Translate.setHttpReferrer("http://code.google.com/p/google-api-translate-java");
    which is the API location.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  7. #7
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,009
    Rep Power
    20

    Default Re: Gettin unkownHostException while trying to translate using microsoft translate AP

    Oops...
    What nonsense.

    Ignore that one.

    I'm now wondering if it's your proxy possibly causing problems.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  8. #8
    sanketroy is offline Member
    Join Date
    Oct 2012
    Posts
    4
    Rep Power
    0

    Default Re: Gettin unkownHostException while trying to translate using microsoft translate AP

    ya may be
    tried it in every possible way i could find.
    i ll try with my home computer and let you know if it works .
    thanks for the help

Similar Threads

  1. application translate to an applet
    By gladwda in forum New To Java
    Replies: 3
    Last Post: 10-25-2011, 10:58 PM
  2. Translate from C# to Java
    By Squezee in forum Java 2D
    Replies: 2
    Last Post: 02-07-2011, 06:07 PM
  3. translate - scale problem
    By gmseed in forum Java 2D
    Replies: 0
    Last Post: 11-16-2010, 08:31 PM
  4. Can translate?
    By workmason in forum New To Java
    Replies: 3
    Last Post: 10-22-2010, 09:11 AM
  5. Translate from C to java
    By ighor10 in forum New To Java
    Replies: 6
    Last Post: 03-27-2010, 09:24 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
  •