microsoft-translator-java-api icon indicating copy to clipboard operation
microsoft-translator-java-api copied to clipboard

Error message

Open shengday opened this issue 11 years ago • 0 comments

I have BT.java:

import com.memetix.mst.language.Language; import com.memetix.mst.translate.Translate;

public class BT { public static void main(String[] args) throws Exception { //Replace client_id and client_secret with your own. Translate.setClientId("shengday"); Translate.setClientSecret("goVdIz/l8fgAwWqYWdzK4RuHKloNoZ5Y5LFO7zMUEno");

// Translate an english string to spanish
String englishString = "Hello World!";
String spanishTranslation = Translate.execute(englishString, Language.SPANISH);

System.out.println("Original english phrase: " + englishString);
System.out.println("Translated spanish phrase: " + spanishTranslation);

} }

On Windows I compiled with "javac -cp .\microsoft-translator-java-api-0.6.2-jar-with-dependencies.jar BT.java", where microsoft-translator-java-api-0.6.2-jar-with-dependencies.jar is downloaded from here.

Then I tried to run "java BT" and got the error message below, what did I do wrong?

Exception in thread "main" java.lang.NoClassDefFoundError: com/memetix/mst/translate/Translate at BT.main(BT.java:7) Caused by: java.lang.ClassNotFoundException: com.memetix.mst.translate.Translate at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 1 more

shengday avatar May 22 '13 19:05 shengday