use google translate API to convert English into text Arabic text in java
Following code i user to convert my string into Arabic
Translate.setHttpReferrer("http://localhost:8080/crmweb/");
String arabicSt开发者_如何学运维ring = Translate.execute(englishString, Language.ENGLISH, Language.ARABIC);
if(arabicString != null){
System.out.println("This method return as arabic string ==============> ");
return arabicString;
}
This code work when i run application in main method , but when i tries to run it in web application it gives an error like -- java.lang.NoClassDefFoundError: com/google/api/translate/Translate
The Google Translate API JARs need to be in the WEB-INF/lib directory of the web application. This is true whether you're building and deploying a WAR file, or simply using a directory structure on disk.
This process is more basically known as "putting the dependency JARs in the webapp's classpath."
精彩评论