Forums Register Login

jar mainifest: Main-Class and Class-Path incompatible?

+Pie Number of slices to send: Send
Hi-
I'm trying to package an application in a jar file which uses some external libs.
When I specify a Class-Path in the manifest, i get a NoClassDefFoundError exception for my Main-Class. When I remove the Class-Path header, of course, I get a NoClassDefFoundError exception for one of the classes I've imported in that main class.

It seems as though if I specify a Class-Path, ONLY the jars listed there are on the classpath - no longer the packages in the jar itself.
What am i doing wrong? (I tried adding "." to the Class-Path - still doesn't work)

FYI - my package is at the root of the jar:
com/mycompany/blah/blah
+Pie Number of slices to send: Send
Please tell us some more details, eg your classpath, how you are setting it, and the contents of your manifest file.
+Pie Number of slices to send: Send
 

Campbell Ritchie wrote:Please tell us some more details, eg your classpath, how you are setting it, and the contents of your manifest file.



well, i'm not setting any specific classpath outside of the manifest. here it is:

I'm using the <manifest> element of ant's <jar> task to create it. 2 strange things i'm noticing are
1. the hard line breaks. Why would it do that? I'm specifying them all in one attribute of the <attibute> node:
2. the non-system friendly paths (slashes wrong way, etc)
I would imagine both of these would cause classpath problems, but, regardless; i would think it would be tbe IMPORTED classes that can't be found. Why would this have any effect on my main class?
+Pie Number of slices to send: Send
The Class-Path entries are supposed to be relative to the location of the executable jar. Absolute locations are not permitted. So fix that up first.

(Yes, Main-Class and Class-Path are compatible, I just did that this afternoon.)
God is a comedian playing for an audience that is afraid to laugh - Voltair. tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1231 times.
Similar Threads
NoClassDefFoundError
NoClassDefFoundError
NoClassDefFoundError
NoClassDefFoundError
NoClassDefFoundError
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 18, 2024 21:54:54.