easily making executables, installers, debs, etc.

Are there tools for easily creating installers from jars for various
platforms? Ideally, the installers would be native and would check
whether jvm is installed and do something user-friendly if it's not.

Advertisements

Guest

If you're targetting Mac users then these users will expect
your Java app to be packaged in the same way as most Mac
application are packaged.

Apple recommends Java apps to be shipped as a .dmg file for
OS X users.

JarBundler can be used on OS X to that effect.

I'm working on an app that is deployed on countless of
various different configs. For Linux and Windows it's
a unique .jar (with jars packaged inside the .jar) while
for OS X we package our application in the way recommended
by Apple: in a .dmg file.

In article
<>, wrote:
> On Apr 15, 12:01 pm, Andrew Thompson <> wrote:
> > On Apr 15, 7:05 pm, fft1976 <> wrote:
> >
> > > Are there tools for easily creating installers from jars for
> > > various platforms?
>
> If you're targetting Mac users then these users will expect
> your Java app to be packaged in the same way as most Mac
> application are packaged.
>
> Apple recommends Java apps to be shipped as a .dmg file for
> OS X users.
>
> JarBundler can be used on OS X to that effect.
>
> I'm working on an app that is deployed on countless of
> various different configs. For Linux and Windows it's
> a unique .jar (with jars packaged inside the .jar) while
> for OS X we package our application in the way recommended
> by Apple: in a .dmg file.

This is good advice. A bare JAR works fine on Mac OS X, but only modest
effort is required to wrap the archive as an application with JarBundler
and package it with DiskUtility. Alternatively, both .app and .dmg can
be constructed via build.xml:

<http://robotchase.svn.sourceforge.net/viewvc/robotchase/trunk/>

Java Web Start is a more compelling choice for target platforms that
lack a vendor-supplied JVM, but it works fine on Mac OS X, which does:

I was talking about Java applications that seem native to the user
(during installation) with no relation to the browser, i.e. *.msi for
Windows users, *dmg (or whatever) for Mac users, *.tar.gz, *rpm and
*.deb for Linux users.

It would seem that the work that needs to be done packaging a pure
Java application into these does not depend on the particular Java
application very much, except for minor configuration details. So I
expected this processes to have been streamlined already.

On 2009-04-15 05:05:40 -0400, fft1976 <> said:
> Are there tools for easily creating installers from jars for various
> platforms? Ideally, the installers would be native and would check
> whether jvm is installed and do something user-friendly if it's not.

For .deb, I'd consider using the deb-maven-plugin from Codehaus:
<http://mojo.codehaus.org/deb-maven-plugin/using-deb.html>

However, I've never used it so I can't speak for how well it
does/doesn't work, and if you're not already using maven, the migration
may be more than you want to bite off. The biggest gotcha that I can
spot is related to generated dependencies: I'm not sure how well its
autoGenerateDepends directive works, so do some experiments.

There is a similar plugin for RPMs:
<http://mojo.codehaus.org/rpm-maven-plugin/>

I don't see an MSI plugin floating around, either on codehaus or
anywhere else. Java programs are pretty close to xcopy-installable by
default, unless you have strange beliefs about installing JARs
"globally" to the system -- don't do that, it's against the grain of
Java's deployment model in practice. Both Redhat and Debian have gone
to a lot of lengths to fake global library installation, but even with
all the manpower spent, it's not great.

Building a Mac .app bundle is probably better done through the assembly
plugin, since Java .apps are little more than directory trees. Details
on the correct structure are available online:

As for the assembly plugin itself, the documentation for it is at:
<http://maven.apache.org/plugins/maven-assembly-plugin/>

To bundle it up as a .dmg, you'll need to run something like
$ hdiutil create -srcfolder root-of-distribution my-project-1.0.dmg
$ hdiutil internet-enable -yes my-project-1.0.dmg

(The internet-enable step is semi-optional but I do wish more DMGs
would use it.)

For a few bucks I'd be happy to write and release as open source a
maven plugin that ties together the steps in building a complete .dmg
from a JAR project; it's not hard, but it's not something I
particularly care about doing ferfree.

It's possible to make installers for various platforms, and it's not
TOO difficult. The problem is that there are MANY of them, also user
friendliness is an issue. What will the installer do if there is no
JVM? Native binary splash screen while the JVM is starting, etc.?

After searching the net for a while, I realized that the only tool
that claims to have the features I want is a commercial one,
install4j, and is rather pricey at $1200/developer, but probably pays
for itself in the productivity saved, assuming its quality is good.

Strange that Sun, IBM or the open-source community haven't solved this
for Java yet.

On 2009-04-16 01:30:18 -0400, fft1976 <> said:
> On Apr 15, 9:48 pm, Owen Jacobson <> wrote:
>
> [...]
>
> It's possible to make installers for various platforms, and it's not
> TOO difficult. The problem is that there are MANY of them, also user
> friendliness is an issue. What will the installer do if there is no
> JVM? Native binary splash screen while the JVM is starting, etc.?
>
> After searching the net for a while, I realized that the only tool
> that claims to have the features I want is a commercial one,
> install4j, and is rather pricey at $1200/developer, but probably pays
> for itself in the productivity saved, assuming its quality is good.
>
> Strange that Sun, IBM or the open-source community haven't solved this
> for Java yet.

That's also highly platform-dependent. The only OS where it's even an
issue is Windows, though:
- .deb and .rpm files can declare dependencies on the Debian/Ubuntu
and Redhat Java meta-packages, which the respective package managers
can deal with.
- OS X has a 1.5 JVM pre-installed; 1.6 is also available via the
platform's software updater for 64-bit CPUs. Apps do not install JVMs.
- Windows doesn't have either a preinstalled or a standard package for
the JVM, so you need to include the Java MSI in your own and offer to
install it if it's not already installed. I haven't read the license,
so I don't even know whether this is actually allowed.

On Wed, 15 Apr 2009 02:05:40 -0700 (PDT), fft1976 <>
wrote, quoted or indirectly quoted someone who said :
>Are there tools for easily creating installers from jars for various
>platforms? Ideally, the installers would be native and would check
>whether jvm is installed and do something user-friendly if it's not.

Share This Page

Welcome to The Coding Forums!

Welcome to the Coding Forums, the place to chat about anything related to programming and coding languages.

Please join our friendly community by clicking the button below - it only takes a few seconds and is totally free. You'll be able to ask questions about coding or chat with the community and help others.
Sign up now!