This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JAR classpath insanity

 
Lucian Smith
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Pie
Posts: 20188
26
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic