"NoClassDefFoundError" when attempting to execute JAR file
Hi All,
I really need help with this problem (at the end of my rope)...
(A) The application I created is Mu01.java - I placed in the directory below
with its supporting .zip/.jar files...
C:\Mu01>dir
Volume in drive C has no label.
Volume Serial Number is 24AB-038C
Directory of C:\Mu01
01/30/2001 09:18p <DIR> .
01/30/2001 09:18p <DIR> ..
04/10/2000 10:01a 1,552,313 classes12.zip
07/31/2000 11:56a 51,780 connectionmanager.zip
07/31/2000 11:56a 73,968 jdev-rt.zip
01/30/2001 09:01p 20 mfst
01/30/2001 10:56a 14,666 Mu01.java <---appl.
03/16/2000 06:03a 10,705,708 rt.jar
6 File(s) 12,398,455 bytes
2 Dir(s) 5,022,380,544 bytes free
(B) This directory also includes a "auxillary" file (i.e., mfst) with the
"Main-Class:" value, as shown...
C:\Mu01>type mfst
Main-Class: Mu01 <----- "Main-Class" information for manifest
(C) I ran javac agains the Mu01.java file to create the class files...
C:\Mu01>javac Mu01.java
(D) This is how my directory looked afterword (I removed the Mu01.java file
from the directory before running the jar utility)...
C:\Mu01>dir
Volume in drive C has no label.
Volume Serial Number is 24AB-038C
Directory of C:\Mu01
01/30/2001 09:25p <DIR> .
01/30/2001 09:25p <DIR> ..
04/10/2000 10:01a 1,552,313 classes12.zip
07/31/2000 11:56a 51,780 connectionmanager.zip
07/31/2000 11:56a 73,968 jdev-rt.zip
01/30/2001 09:01p 20 mfst
01/30/2001 09:25p 1,069 Mu01$1.class
01/30/2001 09:25p 1,025 Mu01$2.class
01/30/2001 09:25p 698 Mu01$3.class
01/30/2001 09:25p 1,100 Mu01$4.class
01/30/2001 09:25p 781 Mu01$5.class
01/30/2001 09:25p 870 Mu01$6.class
01/30/2001 09:25p 533 Mu01$7.class
01/30/2001 09:25p 973 Mu01$8.class
01/30/2001 09:25p 507 Mu01$9.class
01/30/2001 09:25p 9,455 Mu01.class
01/30/2001 10:56a 14,666 Mu01.java
03/16/2000 06:03a 10,705,708 rt.jar
16 File(s) 12,415,466 bytes
2 Dir(s) 5,022,361,088 bytes free
(E)Then I ran the JAR utility to with the "m" option to specify (via the
"auxillary" file: mfst) the "Main-Class:" value...
C:\Mu01>jar cvfm Mu01.jar mfst c:\Mu01\*.*
added manifest
adding: c:/Mu01/classes12.zip(in = 1552313) (out= 547459)(deflated 64%)
adding: c:/Mu01/connectionmanager.zip(in = 51780) (out= 18178)(deflated 64%)
adding: c:/Mu01/jdev-rt.zip(in = 73968) (out= 28948)(deflated 60%)
adding: c:/Mu01/mfst(in = 20) (out= 22)(deflated -10%)
adding: c:/Mu01/Mu01$1.class(in = 1069) (out= 584)(deflated 45%)
adding: c:/Mu01/Mu01$2.class(in = 1025) (out= 604)(deflated 41%)
adding: c:/Mu01/Mu01$3.class(in = 698) (out= 453)(deflated 35%)
adding: c:/Mu01/Mu01$4.class(in = 1100) (out= 662)(deflated 39%)
adding: c:/Mu01/Mu01$5.class(in = 781) (out= 506)(deflated 35%)
adding: c:/Mu01/Mu01$6.class(in = 870) (out= 550)(deflated 36%)
adding: c:/Mu01/Mu01$7.class(in = 533) (out= 368)(deflated 30%)
adding: c:/Mu01/Mu01$8.class(in = 973) (out= 575)(deflated 40%)
adding: c:/Mu01/Mu01$9.class(in = 507) (out= 358)(deflated 29%)
adding: c:/Mu01/Mu01.class(in = 9455) (out= 4628)(deflated 51%)
adding: c:/Mu01/rt.jar(in = 10705708) (out= 3823354)(deflated 64%)
(F) After creating the Mu01.jar file (above), I attempted to execute the
Mu01.jar application, ... but, I am unsuccessful...
C:\Mu01>java -jar Mu01.jar
Exception in thread "main" java.lang.NoClassDefFoundError: Mu01
(G) H E L P ! ! ! - My Question is "Why do I get a "NoClassDefFoundError"
after I have specifically included the "Main-Class" information in the JAR
creation????
What am I doing wrong, what am I leaving out of the manifest, etc...???
Really would appreciate the help
thanks!
Re: "NoClassDefFoundError" when attempting to execute JAR file
The jar utility can be especially picky about manifest contents;
try putting a carriage return after the last line in the manifest file.
Also, some versions of jar were just plain broken when it came to
incorporating manifests; the jar that originally came with JDK 1.2
wouldn't correctly incorporate manifests, and Sun's workaround was
to use the 1.1.8 version of jar...
You can check to see if the manifest was correctly incorporated by
extracting the contents of your jar file using "jar xvf yourJar.jar"
and seeing what's in the manifest.
\
Jon
"sairndain" <sairndain@hotmail.com> wrote:
>
>Hi All,
>
>I really need help with this problem (at the end of my rope)...
>
>(A) The application I created is Mu01.java - I placed in the directory below
>with its supporting .zip/.jar files...
>
>C:\Mu01>dir
> Volume in drive C has no label.
> Volume Serial Number is 24AB-038C
>
> Directory of C:\Mu01
>
>01/30/2001 09:18p <DIR> .
>01/30/2001 09:18p <DIR> ..
>04/10/2000 10:01a 1,552,313 classes12.zip
>07/31/2000 11:56a 51,780 connectionmanager.zip
>07/31/2000 11:56a 73,968 jdev-rt.zip
>01/30/2001 09:01p 20 mfst
>01/30/2001 10:56a 14,666 Mu01.java <---appl.
>03/16/2000 06:03a 10,705,708 rt.jar
> 6 File(s) 12,398,455 bytes
> 2 Dir(s) 5,022,380,544 bytes free
>
>
>(B) This directory also includes a "auxillary" file (i.e., mfst) with the
>"Main-Class:" value, as shown...
>
>C:\Mu01>type mfst
>Main-Class: Mu01 <----- "Main-Class" information for manifest
>
>
>(C) I ran javac agains the Mu01.java file to create the class files...
>
>C:\Mu01>javac Mu01.java
>
>
>(D) This is how my directory looked afterword (I removed the Mu01.java file
>from the directory before running the jar utility)...
>
>C:\Mu01>dir
> Volume in drive C has no label.
> Volume Serial Number is 24AB-038C
>
> Directory of C:\Mu01
>
>01/30/2001 09:25p <DIR> .
>01/30/2001 09:25p <DIR> ..
>04/10/2000 10:01a 1,552,313 classes12.zip
>07/31/2000 11:56a 51,780 connectionmanager.zip
>07/31/2000 11:56a 73,968 jdev-rt.zip
>01/30/2001 09:01p 20 mfst
>01/30/2001 09:25p 1,069 Mu01$1.class
>01/30/2001 09:25p 1,025 Mu01$2.class
>01/30/2001 09:25p 698 Mu01$3.class
>01/30/2001 09:25p 1,100 Mu01$4.class
>01/30/2001 09:25p 781 Mu01$5.class
>01/30/2001 09:25p 870 Mu01$6.class
>01/30/2001 09:25p 533 Mu01$7.class
>01/30/2001 09:25p 973 Mu01$8.class
>01/30/2001 09:25p 507 Mu01$9.class
>01/30/2001 09:25p 9,455 Mu01.class
>01/30/2001 10:56a 14,666 Mu01.java
>03/16/2000 06:03a 10,705,708 rt.jar
> 16 File(s) 12,415,466 bytes
> 2 Dir(s) 5,022,361,088 bytes free
>
>
>(E)Then I ran the JAR utility to with the "m" option to specify (via the
>"auxillary" file: mfst) the "Main-Class:" value...
>
>C:\Mu01>jar cvfm Mu01.jar mfst c:\Mu01\*.*
>added manifest
>adding: c:/Mu01/classes12.zip(in = 1552313) (out= 547459)(deflated 64%)
>adding: c:/Mu01/connectionmanager.zip(in = 51780) (out= 18178)(deflated
64%)
>adding: c:/Mu01/jdev-rt.zip(in = 73968) (out= 28948)(deflated 60%)
>adding: c:/Mu01/mfst(in = 20) (out= 22)(deflated -10%)
>adding: c:/Mu01/Mu01$1.class(in = 1069) (out= 584)(deflated 45%)
>adding: c:/Mu01/Mu01$2.class(in = 1025) (out= 604)(deflated 41%)
>adding: c:/Mu01/Mu01$3.class(in = 698) (out= 453)(deflated 35%)
>adding: c:/Mu01/Mu01$4.class(in = 1100) (out= 662)(deflated 39%)
>adding: c:/Mu01/Mu01$5.class(in = 781) (out= 506)(deflated 35%)
>adding: c:/Mu01/Mu01$6.class(in = 870) (out= 550)(deflated 36%)
>adding: c:/Mu01/Mu01$7.class(in = 533) (out= 368)(deflated 30%)
>adding: c:/Mu01/Mu01$8.class(in = 973) (out= 575)(deflated 40%)
>adding: c:/Mu01/Mu01$9.class(in = 507) (out= 358)(deflated 29%)
>adding: c:/Mu01/Mu01.class(in = 9455) (out= 4628)(deflated 51%)
>adding: c:/Mu01/rt.jar(in = 10705708) (out= 3823354)(deflated 64%)
>
>
>(F) After creating the Mu01.jar file (above), I attempted to execute the
>Mu01.jar application, ... but, I am unsuccessful...
>
>C:\Mu01>java -jar Mu01.jar
>Exception in thread "main" java.lang.NoClassDefFoundError: Mu01
>
>
>(G) H E L P ! ! ! - My Question is "Why do I get a "NoClassDefFoundError"
>after I have specifically included the "Main-Class" information in the JAR
>creation????
>
>What am I doing wrong, what am I leaving out of the manifest, etc...???
>
>
>Really would appreciate the help
>
>thanks!