Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #12174
| Date | 2012-02-19 21:48 -0500 |
|---|---|
| From | Arne Vajhøj <arne@vajhoej.dk> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: is it possible to package a Java application in one jar that includes everything? |
| References | <jhsau8$8oo$1@speranza.aioe.org> |
| Message-ID | <4f41b474$0$289$14726298@news.sunsite.dk> (permalink) |
| Organization | SunSITE.dk - Supporting Open source |
On 2/19/2012 9:25 PM, Nasser M. Abbasi wrote: > Its been few years since I've used Java, since jdk 1.1 I think, > and I'd just like to ask a simple question: > > Is it possible to package my Java application, > including all and any other Java code, that I might have > downloaded from the web and used, into one jar file, > such that one can just download this one jar file and > double click on it on their PC or Linux or Mac, and it > will run (ofcourse one needs to have the JRE installed > on their end). > > I've done something like this before, and I remember using > Makefiles and the jar command > > jar cvf0 myjar.jar .../*.class > > I assume only *.class files can go into a Jar. Can other > jar files go into a Jar file also? > > For example, If I use 3rd party Jar file myself, do I > need to extract the content of that Jar file out first, > and then jar the resulting tree into my jar file? > > Just wanted to check if things has changed, and if > there might be now better tools or ways to do this, > as I have not kept up with Java. > > If someone has a good link I can read on this whole topic > of building one Jar for an application, and what to > watch for, that will help. I am using latest JDK. Java does not standard read jars in jars (you can get special classloaders that can do it though). You can obviously package all the class files you need from various external jar files into you jar file. But I will suggest that you keep your stuff in your jar file and the external stuff in their jar files. That enables independent updates of your stuff and the external stuff. And if it is simplicity of distribution you need, then take a look at Java Web Start. Arne
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar
is it possible to package a Java application in one jar that includes everything? "Nasser M. Abbasi" <nma@12000.org> - 2012-02-19 20:25 -0600
Re: is it possible to package a Java application in one jar that includes everything? Arne Vajhøj <arne@vajhoej.dk> - 2012-02-19 21:48 -0500
Re: is it possible to package a Java application in one jar that includes everything? Lew <noone@lewscanon.com> - 2012-02-19 22:41 -0800
Re: is it possible to package a Java application in one jar that includes everything? Arne Vajhøj <arne@vajhoej.dk> - 2012-02-20 18:44 -0500
Re: is it possible to package a Java application in one jar that includes everything? Roedy Green <see_website@mindprod.com.invalid> - 2012-02-19 19:02 -0800
Re: is it possible to package a Java application in one jar that includes everything? Fredrik Jonson <fredrik@jonson.org> - 2012-02-20 20:48 +0000
Re: is it possible to package a Java application in one jar that includes everything? Lew <noone@lewscanon.com> - 2012-02-20 14:28 -0800
Re: is it possible to package a Java application in one jar that includes everything? Arne Vajhøj <arne@vajhoej.dk> - 2012-02-20 18:42 -0500
csiph-web