Home arrow static arrow Java Programming [Archive] - Weird NoClassDefFoundError while running from newly written jar
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - Weird NoClassDefFoundError while running from newly written jar
This topic has 2 replies on 1 page.

Posts:20
Registered: 8/13/03
Weird NoClassDefFoundError while running from newly written jar  
Aug 4, 2004 10:29 PM



 
Hi all,
I need to add some classfiles that are generated on the fly into a jar file and then deploy the jar. I am facing a peculiar problem when trying to run the java program from the newly created jar. It throws up an NoClassDefFoundError when running java like this:
java -classpath <thejarfile.jar> <package>.<classname>
But I have noticed that if I extract the classes inside the jar and then again pack it, it works absolutely fine. Also I noticed that if I open both the jars(one that my program created, and the other, the repacked one) in winzip, the files in the new one all have an attribute marked "A" whereas the orginal one dosent have that.
Any idea what might be the problem?
 

Posts:2,206
Registered: 8/15/02
Re: Weird NoClassDefFoundError while running from newly written jar  
Aug 4, 2004 10:36 PM (reply 1 of 2)



 
You could try running the following...

java -jar <myJarFile> <myPackage>.<myMainClass>
 

Posts:20
Registered: 8/13/03
Re: Weird NoClassDefFoundError while running from newly written jar  
Aug 4, 2004 10:48 PM (reply 2 of 2)



 
No. But then we would be required to include the Manifest file. We are not doing that. Actually the class which has the main method may or may not be in the jar file we are updating. What we are doing is that we are changing some particular classes and updating our application libraries, instead of doing a whole big build.
 
This topic has 2 replies on 1 page.