I am running a server and it uses classes in a package common.jar but I get a 'NoClassDefFound' exception when I run it. (JDK1.4)
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Daniel_Knightly
Posted On:   Wednesday, June 26, 2002 09:56 AM

I am running a server and it uses classes in a package common.jar but I get a 'NoClassDefFound' exception when I run it.


I am using the command:


java -cp /pathToCommonJar/common.jar -jar myServer.jar


and for some reason it doesn't seem to find the classes in common.jar (I checked common.jar and all the classes are there using 'jar -tvf common.jar')


any ideas?

Using java -jar overwrites classpath

Posted By:   Daniel_Knightly  
Posted On:   Wednesday, June 26, 2002 10:46 AM

To answer my own question, it turns out that using
java -jar myfile.jar overwrites classpath.


If you need to specify a classpath in an executable jarfile
you need to add it to the jar file's MANIFEST.MF file.


the syntax is:


Class-Path: /path1/jarFile1.jar /path2/jarFile2.jar


multiple paths are space separated.

About | Sitemap | Contact