Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JAR classpath insanity

 
Lucian Smith
Greenhorn
Posts: 4
  • 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
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic