wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes including jar files in jar files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "including jar files in jar files" Watch "including jar files in jar files" New topic

including jar files in jar files

Paul Keohan
Ranch Hand

Joined: Mar 15, 2000
Posts: 411
I want to deploy a jar file. I have included two other jar files in it because they contain code that's needed by my class files. This doesn't seem to work unless I deploy those two jar files separately and stick them in the same directory as my jar file.
Is there a way for the jar file to look at itself for other jar files? I println the classpath when the main method is called and the classpath is the jar files itself - even though I point Class-Path at something else in the manifest.
Dave Landers
Ranch Hand

Joined: Jul 24, 2002
Posts: 401
You can create one jar that contains the contents from all the other jars. But nesting jars within other jars will not work.
Paul Keohan
Ranch Hand

Joined: Mar 15, 2000
Posts: 411
Is there a way to do this using the 'jar' command rather than extracting all contents of the jar files first and then adding them to my jar?
Dirk Schreckmann

Joined: Dec 10, 2001
Posts: 7023
I don't think so.

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
I agree. Here's the link: http://aspose.com/file-tools
subject: including jar files in jar files
Similar Threads
Jar question
Imbedded jar file
error delploying ear file on JBOSS 3.0.8
finding files in a jar
java.sql.SQLException: No suitable driver