aspose file tools*
The moose likes Java in General and the fly likes JAR classpath insanity Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "JAR classpath insanity" Watch "JAR classpath insanity" New topic
Author

JAR classpath insanity

Lucian Smith
Greenhorn

Joined: Mar 04, 2006
Posts: 4
My mind is gone. Here is the situation: Using Eclipse I generate a jar file containing the following structure:

com
libs
META-INF
application.properties
log4j.properties

Okay, I made a manifest that specified an entry point for my app (this part works). What doesn't work is that I'm getting a NoClassDefFoundError NO MATTER WHAT I DO. I tried specifing like 1000 varieties of Class-Path: in the manifest, with paths like libs/commons-configuration-1.4/commons-configuration-1.4.jar or ./libs or even putting the jars right in the libs directory or even in the same directory at the main class.

I run the jar with java -jar JarName.jar

but I also put in all sorts of -classpath specifications...

Basically no matter what I do, nothing is working.

All the library JARS I have in my main jar. All I need is for my main class (in the jar) to have the library jars (also in the jar) in its classpath.

Thank you everyone!!!
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18154
    
    8

All the library JARS I have in my main jar.
You mean inside the main jar? Then that's your problem. Don't do that, standard classloaders won't find jars inside jars. Put them in the same directory as your executable jar. The path you put in the manifest for a library jar is relative to the executable jar.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JAR classpath insanity
 
Similar Threads
Building a jar with dependancies.
include jar in an executable jar
Putting un-jarred config files on the manifest classpath
Jar Files in another jar file (MANIFEST.MF Question)
EARs, WARs, classpaths, and manifests