Results 1 to 7 of 7
Thread: Creating JAR file goes wrong.
- 11-02-2009, 10:22 AM #1
Member
- Join Date
- Oct 2009
- Posts
- 56
- Rep Power
- 0
Creating JAR file goes wrong.
I have created a jar file, at first there was some error about no main, so I added a manifest. Now I get this error, but I cannot figure out what it means.
C:\>java -jar img.jar
Exception in thread "main" java.lang.NoClassDefFoundError: image$Mode
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.ja va:2427)
at java.lang.Class.getDeclaredMethod(Class.java:1935)
at java.awt.Component.isCoalesceEventsOverriden(Compo nent.java:5948)
at java.awt.Component.access$500(Component.java:169)
at java.awt.Component$3.run(Component.java:5902)
at java.awt.Component$3.run(Component.java:5900)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Component.checkCoalescing(Component.java: 5899)
at java.awt.Component.<init>(Component.java:5868)
at java.awt.Container.<init>(Container.java:251)
at java.awt.Panel.<init>(Panel.java:48)
at java.awt.Panel.<init>(Panel.java:40)
at java.applet.Applet.<init>(Applet.java:48)
at image.<init>(image.java:42)
at image.main(image.java:238)
Caused by: java.lang.ClassNotFoundException: image$Mode
at java.net.URLClassLoader$1.run(URLClassLoader.java: 200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.j ava:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:3 07)
at sun.misc.Launcher$AppClassLoader.loadClass(Launche r.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:2 52)
at java.lang.ClassLoader.loadClassInternal(ClassLoade r.java:320)
Some help please? :)
- 11-02-2009, 03:22 PM #2
Member
- Join Date
- Sep 2009
- Posts
- 22
- Rep Power
- 0
Check your manifest, did you accidentally put a space in your Class imageMode?
(like this: image Mode)
Also I highly recommend capitalizing the first letter of your classes, it's a good convention to follow.
A post showing what your manifest looks like and the classes you have in your jar would be helpful.
- 11-02-2009, 04:07 PM #3
Member
- Join Date
- Oct 2009
- Posts
- 56
- Rep Power
- 0
I only have one class in the jar file, it is called image.class so there are no spaces.
The manifest is like this:
Manifest-Version: 1.0
Main-Class: image
And if I remember correctly the jar creating I did was like this:
jar cvfm image.jar manifest.mf image.class
- 11-02-2009, 04:13 PM #4
Member
- Join Date
- Sep 2009
- Posts
- 22
- Rep Power
- 0
I will assume then that your image.java has the class name as image? If not, the problem lies there.
The jar itself looks ok. Are you sure you aren't missing any other classes that you might need?
- 11-02-2009, 04:19 PM #5
Member
- Join Date
- Oct 2009
- Posts
- 56
- Rep Power
- 0
class name image? you mean the class file is called image.class? yes.
- 11-02-2009, 04:28 PM #6
Member
- Join Date
- Sep 2009
- Posts
- 22
- Rep Power
- 0
No, I am referring to the actual source, the image.java file should have this line:
public class image {
}
If that is not the case, that would be the cause of the error. The error itself states that it cannot find the class image$Mode. That leads me to believe that either the image$Mode.class file is missing, or the image.class file should be named image$Mode.
If you do not have the image.java file, then I would try renaming the image.class file to image$Mode and see if that does anything.
- 11-02-2009, 04:32 PM #7
Member
- Join Date
- Oct 2009
- Posts
- 56
- Rep Power
- 0
Similar Threads
-
Creating a .jar file
By Wataru in forum New To JavaReplies: 3Last Post: 07-22-2009, 06:02 AM -
Creating jar file
By Heather in forum Advanced JavaReplies: 4Last Post: 02-11-2009, 09:58 AM -
Downloading part of a file with java? What have I done wrong?
By JavaHead08 in forum NetworkingReplies: 1Last Post: 05-30-2008, 10:33 PM -
creating jar file
By po0oker in forum Advanced JavaReplies: 3Last Post: 04-04-2008, 07:49 PM -
creating .ear file
By psn in forum Enterprise JavaBeans (EJB)Replies: 1Last Post: 01-06-2008, 05:01 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks