Reputation: 105
I cannot seem to run my java program because it thinks my MO.class file is in the classpath for my gson library. What am I doing wrong?
$ ls
gson MO.java
$ javac -cp .:gson/gson/target/gson-2.7.1-SNAPSHOT.jar MO.java
$ java -cp .:gson/gson/target/gson-2.7.1-SNAPSHOT.jar MO
Exception in thread "main" java.lang.NoClassDefFoundError: MO (wrong name: com/google/gson/MO)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:803)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)
Upvotes: 1
Views: 88