I am trying to run the code here — http://code.google.com/p/android-market-api/wiki/HowDownloadApps
–, and have this code in a Tester.java file (shown below). Two .jars are also in the same directory as this file, named androidmarketapi-0.6.jar and protobuf-java-2.2.0.jar. Both are in my classpath (I’m on Windows 7). It compiles fine, with the command “javac Tester.java”. A Tester.class file is created in the same directory.
public class Tester {
public static void main (String[] args) {
MarketSession session = new MarketSession(true);
System.out.println("login...");
}
}
However, the program will not run!
java Tester
and
java -cp . Tester
both yield the below error message:
Exception in thread "main" java.lang.NoClassDefFoundError: Tester
(wrong name: com/gc/android/market/api/Tester)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
And there’s 9~ more of these “at java.net”, “at java.security”, “at sun.misc,”
“at sun.launcher” type error messages.
Anyone have any idea?
Thanks!
Based on the error message, I can see that Tester is inside a package
com.gc.android.market.apiI would expect your console command to be something like
java com.gc.android.market.api.Tester