File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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: 24199

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

[Jess in Action][AskingGoodQuestions]
I agree. Here's the link:
subject: jar files
It's not a secret anymore!