Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » including a .jar file's content in another .jar file?
including a .jar file's content in another .jar file? [message #112063] Thu, 30 October 2003 12:00 Go to next message
Eclipse UserFriend
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 #112165 is a reply to message #112063] Thu, 30 October 2003 18:32 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: richkulp.NO.SPAM.us.ibm.com

The big question is do you have the license to do that? It may not be
legal to do that.

--
Thanks, Rich Kulp

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 Go to previous messageGo to next message
Eclipse UserFriend
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 #112486 is a reply to message #112165] Fri, 31 October 2003 11:03 Go to previous messageGo to next message
Eclipse UserFriend
That's not the issue here - it's for company internal purposes only.

"Rich Kulp" <richkulp@NO.SPAM.us.ibm.com> wrote in message
news:bns70b$ikh$1@eclipse.org...
> The big question is do you have the license to do that? It may not
be
> legal to do that.
>
> --
> Thanks, Rich Kulp
> 
>
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 Go to previous message
Eclipse UserFriend
"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
Previous Topic:About Compile problem
Next Topic:tomcat launcher does not launch - plugin crashes
Goto Forum:
  


Current Time: Fri Oct 31 17:04:32 EDT 2025

Powered by FUDForum. Page generated in 0.26347 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top