jQuery in Action, 3rd edition
The moose likes Java in General and the fly likes jar files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "jar files" Watch "jar files" New topic

jar files

Terrence White
Ranch Hand

Joined: Jun 26, 2002
Posts: 39
Is there a way for me to place jars inside of an executable jar and get it to run?
When I put them inside of my executable jar, the files cannot be found, and I get the infamous "java.lang.NoClassDefFoundError" error.
How can I get the classpath to look into the executable jar?
I tried editing the manifest:
Class-Path: firstFile.jar secondFile.jar
But this only works if the jar files are in the same directory as the executable jar.
My jar files are inside of the executable jar.
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24195

Unpack the "nested jars" and jar them along with the other classes.

[Jess in Action][AskingGoodQuestions]
I agree. Here's the link: http://aspose.com/file-tools
subject: jar files
It's not a secret anymore!