luigimarmo / google-api-translate-java

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

i want to run the program what u given as example #133

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
i used the following main pro gramme 

package internationlization;

/**
 *
 * @author jacqui
 */
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://java.com");

    String translatedText = Translate.execute("Bonjour le monde",
            Language.FRENCH, Language.ENGLISH);

    System.out.println(translatedText);
  }
}
What is the expected output? What do you see instead?
i want to see after translate 

What version of the product are you using? On what operating system?

google-api-translate-0.95.jar  .. Ubuntu operating system
Please provide any additional information below.

Exception in thread "main" java.lang.Exception: [google-api-translate-java] 
Error retrieving translation.
        at com.google.api.GoogleAPI.retrieveJSON(GoogleAPI.java:131)
        at com.google.api.translate.Translate.execute(Translate.java:69)
        at internationlization.Main.main(Main.java:20)
Caused by: java.net.ConnectException: Connection timed out
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:327)
        at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:193)
        at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:180)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:384)
        at java.net.Socket.connect(Socket.java:546)
        at java.net.Socket.connect(Socket.java:495)
        at sun.net.NetworkClient.doConnect(NetworkClient.java:178)
        at sun.net.www.http.HttpClient.openServer(HttpClient.java:409)
        at sun.net.www.http.HttpClient.openServer(HttpClient.java:530)
        at sun.net.www.http.HttpClient.<init>(HttpClient.java:240)
        at sun.net.www.http.HttpClient.New(HttpClient.java:321)
        at sun.net.www.http.HttpClient.New(HttpClient.java:338)
        at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:935)
        at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:876)
        at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:801)
        at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:979)
        at com.google.api.GoogleAPI.retrieveJSON(GoogleAPI.java:115)
        ... 2 more
Java Result: 1

Original issue reported on code.google.com by gummadi....@gmail.com on 16 Mar 2011 at 6:21

GoogleCodeExporter commented 9 years ago
Looks like a local network problem.

Original comment by rich.mid...@gmail.com on 5 Nov 2011 at 5:29