I'm sorry if this has been posted before but I seem to have read and understand that there are many possible causes to this problem and fixes. I am creating a Jetty server and am trying to compile it from the command line instead of Eclipse IDE, I am using this javac command to compile it:
javac -cp jetty-all.jar:servlet-api.jar Handle.java Listener.java Files.java StartStopServer.java Main.java
Main.java is the class I run the program from in Eclipse.
When I do:
java -cp jetty-all.jar:servlet-api.jar:. Main
It gives me the following error:
Exception in thread "main" java.lang.NoClassDefFoundError: Main (wrong name: com/gorillalogic/quotes/Main)
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)
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:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:480)
Can anyone help me with just this info, or do you need more? Please kindly reply. I am willing to post code, however, I didn't want to post it if it wasn't necessary. Sorry if this is a dumb mistake or I am stupid.
Thanks!
-Henry
Copyright Notice:Content Author:「user1529476」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/15076180/java-java-lang-noclassdeffounderror