Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #38892
| Path | csiph.com!news.dns-netz.com!news.freedyn.net!newsreader4.netcologne.de!news.netcologne.de!.POSTED.2001-4dd3-ae38-0-ada1-1290-a847-1871.ipv6dyn.netcologne.de!not-for-mail |
|---|---|
| From | Patrick Roemer <sangamon@netcologne.de> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Preferred way to distribute application |
| Date | Wed, 10 Apr 2019 16:22:16 +0200 |
| Organization | news.netcologne.de |
| Distribution | world |
| Message-ID | <q8ku6o$ur$1@newsreader4.netcologne.de> (permalink) |
| References | <q8fb8g$243$1@gioia.aioe.org> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8 |
| Content-Transfer-Encoding | 7bit |
| Injection-Date | Wed, 10 Apr 2019 14:22:16 -0000 (UTC) |
| Injection-Info | newsreader4.netcologne.de; posting-host="2001-4dd3-ae38-0-ada1-1290-a847-1871.ipv6dyn.netcologne.de:2001:4dd3:ae38:0:ada1:1290:a847:1871"; logging-data="987"; mail-complaints-to="abuse@netcologne.de" |
| User-Agent | Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.24) Gecko/20100411 Thunderbird/2.0.0.24 Mnenhy/0.7.6.0 |
| X-Mozilla-News-Host | news://news.netcologne.de |
| In-Reply-To | <q8fb8g$243$1@gioia.aioe.org> |
| Content-Language | en-US |
| Xref | csiph.com comp.lang.java.programmer:38892 |
Show key headers only | View raw
Responding to Graeme Geldenhuys: > What is the preferred way to distribute a console java application? > > For example: > > 1. Package everything into a single JAR with embedded jar > dependencies. This requires some kind of Main wrapper for custom class loading, since nested jars cannot be handled by the default class loader(s). At least that was the status the last time I checked. Build tools that support this option will automagically generate such a wrapper for you, and I wouldn't expect any problems from these, but it does add some additional complexity under the hood. > 2. Package application into a single JAR but don't embed any > dependency jars. Have the dependency jars as a separate > downloadable archive. I certainly wouldn't recommend a separate download. However, you could zip your jar together with the dependency jars and set up the proper relative classpath in your jar's manifest. This is probably the most brittle and pedestrian option, but it might work ok. > 3. Package everything into a single JAR with related > dependencies but dependencies are unpacked - seems to > produce a slightly smaller final jar. That's probably the most common option. As long as you're not planning to do the packaging manually (you shouldn't!), I don't think the choice between 1 and 3 makes a huge difference. If you're worried about jar size, there's tools like ProGuard that specialize on this aspect. > At the moment I don't have a lot of dependencies, but you never know > what the future of the project might dictate. > > Not sure if it matters, but I'm using Eclipse to build the final JAR. In > the future I would like to let Maven do this for me so I can automate > builds. Just use whatever your build tool supports out-of-the-box. In the case of Maven, that's probably the assembly plugin with jar-with-dependencies settings, resulting in option 3 above. In the unlikely case of running into name clashes in your dependencies, move on to the shade plugin. Best regards, Patrick
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Find similar | Unroll thread
Preferred way to distribute application Graeme Geldenhuys <graemeg@example.net> - 2019-04-08 12:28 +0100
Re: Preferred way to distribute application Joerg Meier <joergmmeier@arcor.de> - 2019-04-08 14:46 +0200
Re: Preferred way to distribute application Graeme Geldenhuys <graemeg@example.net> - 2019-04-10 10:29 +0100
Re: Preferred way to distribute application Patrick Roemer <sangamon@netcologne.de> - 2019-04-10 16:22 +0200
csiph-web