4

I have a java application from which I build a jar that relies on many third party jars, what's the best/common way of packaging this application for end user distribution?

3 Answers3

3

The best way is to use a build tool like Maven2 or something similar, and use that to manage your dependencies and build a all-in-one package.

Otherwise, you'd mostly be stuck with messing with manifest files. Although, IDEs like Eclipse or NetBeans may help you a bit with that.

Goran Jovic
  • 9,418
  • 3
  • 43
  • 75
3

The way packaging is done. There are two ways

  1. wrap as executable: This is common, if you know the supportable platform and wrap the Jar in executable. And distribute it. Something like this http://launch4j.sourceforge.net/ (I have not used this, but there are similar wrapper available)

  2. Bundle all Jar and provide script: You can use Maven's Assembly plug-in to bundle everything in one Jar. With this done, you can distribute with a bat file and a .sh file for Windows and Linux based systems respectively. If you see Glassfish is distributed in similar manner. These scripts has executable command and, often take parameters for different behaviors.

Nishant
  • 54,584
  • 13
  • 112
  • 127
1

You can also use Fat Jar Eclipse Plug-In

OR

Packaging and Deploying Desktop Java Applications in NetBeans

Naveed
  • 41,517
  • 32
  • 98
  • 131