Reputation: 103397
Trying to run jar program and getting class not found error.
As shown in the figure, I have packaged all my dependent jar under lib folder and packaged it inside jar file.
Contents of lib directory:
In my manifest.mf file i have
Manifest-Version: 1.0
Class-Path: .\lib\arapi63.jar;.\lib\spring.jar;.\lib\commons-logging.j
ar;.\lib\log4j.jar;..\conf;.\lib\ojdbc14.jar
Created-By: 1.5.0_12 (Sun Microsystems Inc.)
Main-Class: RemedyRecord
when i try to run this jar using
java -jar remedyDSTX.jar
Exception in thread "main" java.lang.NoClassDefFoundError:
com/remedy/arsys/api/ARException
No ARException class is present in arapi63.jar which is present in my classpath and so am not sure why is that not referenced here...any thoughts?
Update:
Manifest-Version: 1.0
Class-Path: lib/arapi63.jar;lib/spring.jar;lib/commons-logging.jar;lib
/log4j.jar;lib/ojdbc14.jar
Created-By: 1.5.0_12 (Sun Microsystems Inc.)
Main-Class: RemedyRecord
I updated my manifest as per Jon's comment below but still am getting same error message.
Upvotes: 0
Views: 215
Reputation: 1499780
I believe the problem is the format of your Class-Path
entry.
As per the tutorial:
You specify classes to include in the Class-Path header field in the manifest file of an applet or application. The Class-Path header takes the following form:
Class-Path: jar1-name jar2-name directory-name/jar3-name
Note that this is space-separated, and uses a forward-slash between the directory name and the jar file name.
So try a Class-Path
entry of:
Class-Path: lib/arapi63.jar lib/spring.jar lib/commons-logging.jar lib/log4j.jar lib/ojdbc14.jar
Note that I've removed the ../conf
part - I don't believe you can add a directory to the classpath within a jar file manifest. (I've just tried, and it didn't work.)
Upvotes: 3