Java – unable to load main class manifest attribute
•
Java
I have an error after exporting from eclipse:
C:\Program Files\Java\jre6\bin>java C:\wamp\www\JOGL\test.jar Exception in thread "main" java.lang.NoClassDefFoundError: C:\wamp\www\JOGL\test/jar Caused by: java.lang.ClassNotFoundException: C:\wamp\www\JOGL\test.jar 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) Could not find the main class: C:\wamp\www\JOGL\test.jar. Program will exit.
Show from this file:
Manifest-Version: 1.0 Sealed: true Main-Class: windows.SimpleScene
The same error occurred when using fat jar export
to update:
C:\Program Files\Java\jre6\bin>java -jar C:\wamp\www\JOGL\test.jar Exception in thread "main" java.lang.NoClassDefFoundError: javax/media/opengl/GLEventListener at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClassCond(UnkNown Source) at java.lang.ClassLoader.defineClass(UnkNown Source) at java.security.SecureClassLoader.defineClass(UnkNown Source) at java.net.urlclassloader.defineClass(UnkNown Source) at java.net.urlclassloader.access$000(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) Caused by: java.lang.ClassNotFoundException: javax.media.opengl.GLEventListener 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) ... 12 more Could not find the main class: windows.SimpleScene. Program will exit.
Solution
To run the jar file, run:
java -jar (name-of-jar-file)
So you should run:
java -jar C:\wamp\www\JOGL\test.jar
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码