Java and Jar files

Hi,
   I've written a small app that uses data stored in  important.jar

   This is in my classpath so everything works nicely. Now I want to package up my app into  mywork.jar - but of course when I run it, it complains about not being able to find the files from important.jar

   Is there an easy way to put them all in the same jar file?  I really only want to give users a single file to work with instead of a small collection :)


thanks in advance!
LVL 1
petepalmerAsked:
Who is Participating?
 
objectsConnect With a Mentor Commented:
Assuming you want to create an executable jar, then add a Class-Path attribute to your jars manifest to specify the (relative) location of the other required jar

eg. if important.jar is in same directory then add:

Class-Path: important.jar
0
 
sciuriwareCommented:
Why not bundle everything together in ONE jar?
;JOOP!
0
 
petepalmerAuthor Commented:
I was hoping there was a way to do it with just one jar as opposed to two. The reason I don't want to take the files out of important.jar is that it's maintained by a friend of mine so I want it to be easy to update. Granted if I use classpath upgrading is simplicity itself - you just copy over the new jar file... but is there no other way? :)


0
 
objectsCommented:
how can you do it with one jar, but without taking the files out of important.jar :)
If you use the appraoch I suggested above then there is no change required to the classpath.
0
 
petepalmerAuthor Commented:
I couldn't think of another way either.... couldn't find anything in the docs... but just hoped I was being thick :)

Ah well, two jar files it is then! :)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.