| Home » Language IDEs » Java Development Tools (JDT) » including a .jar file's content in another .jar file?
 Goto Forum:| 
| including a .jar file's content in another .jar file? [message #112063] | Thu, 30 October 2003 12:00  |  | 
| Eclipse User  |  |  |  |  | Hi all, I have a question/problem that should be all too familiar:
 
 We would like to create a .jar file of our project that includes
 EVERYTHING that is needed to run the application, i..e. it should be
 sufficient to download and then double-click, or start, resp. the .jar
 file and the app should start up and run and find all its resources,
 etc.
 
 Now, the point here is, that our app is using several libraries
 (xerces, logging, etc.) that already come as .jar files. Since .jar
 files can't be nested (unless one uses special class loaders or other
 kind of tricks) they can not be included in the .jar file as is (I
 mean, one can of course include them, but that would be of no use,
 i.e. they classes would not be found).
 
 So there seems to be just one way, which is to include the *content*
 of such a library .jar file, i.e. to unpack a .jar file and include
 all its *content* into the new all-in-one .jar file.
 
 So far, I did it by hand, i.e. I created a subdirectory into which I
 unzipped the .jar file and then I included that subdirectory into the
 ..jar file. But I guess this would be more elegant if this could
 somehow be done on the fly, e.g. using ant, during the .jar creation.
 Or wouldn't it be nice, if eclipse would somehow support that, i.e. if
 one selects a .jar file in the .jar package creator then eclipse would
 automatically know that it should unpack and include a .jar's content
 into the newly created .jar?
 
 Any comments, whether or not this is a good idea for a feature
 request? Or are there other solutions to this?
 
 Michael
 |  |  |  |  |  |  | 
| Re: including a .jar file's content in another .jar file? [message #112423 is a reply to message #112063] | Fri, 31 October 2003 09:15   |  | 
| Eclipse User  |  |  |  |  | Originally posted by: mark_lybarger.nospam.yahoo.com 
 I think borland has a feature like this. At least ISTR seeing in in
 version 6 or 7.
 
 I worked on a standalone database poling application, that needed several
 libs.  I did the same thing you mention here in an ant script to make
 deployment easier (and running didn't require setting up a classpath
 either).  The guy who came along after me, changed the app back to using
 several jars.  I guess it's debatable weather this is a good route to go.
 
 Another option is to package it as a zip file and have _your_ jar file
 reference the other jars via a Manifest.MF file.  This way you don't need
 to set classpaths either.  The app knows where the jars are and how to get
 to them.
 
 
 
 Michael Moser wrote:
 
 > Hi all,
 > I have a question/problem that should be all too familiar:
 
 > We would like to create a .jar file of our project that includes
 > EVERYTHING that is needed to run the application, i..e. it should be
 > sufficient to download and then double-click, or start, resp. the .jar
 > file and the app should start up and run and find all its resources,
 > etc.
 
 > Now, the point here is, that our app is using several libraries
 > (xerces, logging, etc.) that already come as .jar files. Since .jar
 > files can't be nested (unless one uses special class loaders or other
 > kind of tricks) they can not be included in the .jar file as is (I
 > mean, one can of course include them, but that would be of no use,
 > i.e. they classes would not be found).
 
 > So there seems to be just one way, which is to include the *content*
 > of such a library .jar file, i.e. to unpack a .jar file and include
 > all its *content* into the new all-in-one .jar file.
 
 > So far, I did it by hand, i.e. I created a subdirectory into which I
 > unzipped the .jar file and then I included that subdirectory into the
 > ..jar file. But I guess this would be more elegant if this could
 > somehow be done on the fly, e.g. using ant, during the .jar creation.
 > Or wouldn't it be nice, if eclipse would somehow support that, i.e. if
 > one selects a .jar file in the .jar package creator then eclipse would
 > automatically know that it should unpack and include a .jar's content
 > into the newly created .jar?
 
 > Any comments, whether or not this is a good idea for a feature
 > request? Or are there other solutions to this?
 
 > Michael
 |  |  |  |  |  |  | 
| Re: including a .jar file's content in another .jar file? [message #112497 is a reply to message #112423] | Fri, 31 October 2003 11:08  |  | 
| Eclipse User  |  |  |  |  | "Mark" <mark_lybarger@nospam.yahoo.com> wrote in message news:bntqqg$5os$1@eclipse.org...
 > I think borland has a feature like this. At least ISTR seeing in in
 > version 6 or 7.
 > ...
 > Another option is to package it as a zip file and have _your_ jar
 file
 > reference the other jars via a Manifest.MF file.  This way you don't
 need
 > to set classpaths either.  The app knows where the jars are and how
 to get
 > to them.
 
 That's what I am doing already, but it requires people to either
 download and unzip a file or they need to download several .jar files
 an place them all into the same directory. Nothing that couldn't be
 done, but of course it would be nice to simply tell them: get this
 file (e.g. by providing a link to download it), run or double click it
 and Bingo!
 
 Michael
 |  |  |  | 
 
 
 Current Time: Fri Oct 31 10:35:53 EDT 2025 
 Powered by FUDForum . Page generated in 0.04371 seconds |