开发者

Language Translation API

开发者 https://www.devze.com 2022-12-29 03:43 出处:网络
How can i convert language in my Java? Is there any API exist, which convert any language to any other language? I am using Google Translate API, but it giving me below exception.

How can i convert language in my Java? Is there any API exist, which convert any language to any other language? I am using Google Translate API, but it giving me below exception.

java.lang.Exception: [google-api-translate-java] Error retrieving translation.
at com.google.api.GoogleAPI.retrieveJSON(GoogleAPI.java:123)
at com.google.api.translate.Translate.execute(Translate.java:69)
at com.nextenders.client.beans.ruleengine.RuleEngineTest.main(RuleEngineTest.java:27)
Caused by: java.net.ConnectException: Connection timed out: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at sun.net.NetworkClient.doConnect(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.<init>(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
null
at sun.net.www.protoco开发者_开发问答l.http.HttpURLConnection.getOutputStream(Unknown Source)
at com.google.api.GoogleAPI.retrieveJSON(GoogleAPI.java:107)
... 2 more 

If anybody knows any API for translation, please tell me.


As suggested by the guy on JavaRanch, there is an issue with the connection to the API

Somewhere you will have specified a URL to connect to, something is blocking that, check you can access that address via ping

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号