Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #12199

Re: is it possible to package a Java application in one jar that includes everything?

From Fredrik Jonson <fredrik@jonson.org>
Newsgroups comp.lang.java.programmer
Subject Re: is it possible to package a Java application in one jar that includes everything?
Date 2012-02-20 20:48 +0000
Message-ID <slrnjk5ccj.2kq.fredrik@scout.jonson.org> (permalink)
References <jhsau8$8oo$1@speranza.aioe.org>

Show all headers | View raw


In <jhsau8$8oo$1@speranza.aioe.org> Nasser M. Abbasi wrote:

>  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.

You can. If you use maven for build management you can use the shade plugin
to build such "uberjars". I believe there are similar utilities for ant.

https://maven.apache.org/plugins/maven-shade-plugin/

>  I've done something like this before, and I remember using Makefiles and
>  the jar.

Yes, jar files are just a zip container for class files so that is
possible. You can put whatever files (resources) you like in the jar, not
only class files.

If you have more than one project I'd strongly recommend avoiding Makefiles
nowdays and using maven, ant, ivy or some other special purpose build
management tool for java.

https://maven.apache.org/guides/getting-started/maven-in-five-minutes.html

--
Fredrik Jonson

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

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