I would like to know about the various options for distributing a Java application.
I know that you can
I'm hoping for some explanations about the most common options (and one's I haven't thought of) and in particular, do they require a user to have a JVM, or can it be bundled with one - personally I'm not too fond of an installer which halts due to a lack of JVM. Who says an app needs an installer, stand-alone solutions are fine too.
Also, worth asking is how to handle cross-platform distributing, exe's vs dmg's, etc...
My primary motivation for this question (which I appreciate is similar to others) is to find solutions that don't require the user to already have a JVM installed - but for completeness, I'm asking generally.
Thanks very much
Most Java software nowadays runs only on servers (web servers or app servers). They are typically deployed as WAR or EAR files, which are also ZIP archives containing classes and other resources. These applications then run inside a server component following the Servlet or EJB standards.
Distribute the Source Code and let users compile it themselves, or provide make files, etc..
This is probably ok for open source projects, but very unusual for anything commercial. I'd recommend providing it as an option for the techies, but distributing JARs also
Package it into a JAR
I'd call this the best practice
and have self extracting archives
How about making the jar executable instead?
I'm hoping for some explanations about the most common options (and one's I haven't thought of) and in particular, do they require a user to have a JVM, or can it be bundled with one - personally I'm not too fond of an installer which halts due to a lack of JVM.
I don't think it's legal to bundle JREs. That said, it's rather obvious that a java-based solution won't work without Java. OpenOffice and many others fail to install without an installed JRE. I'd say that's understandable and OK.
IzPack seems to be a good solution to create Java-based installers.
My primary motivation for this question (which I appreciate is similar to others) is to find solutions that don't require the user to already have a JVM installed
As I wrote, I think it's not legal to bundle the JRE [UPDATE: it is legal, read this document for reference] (and also not a good option, as you'd have to bundle many different OS / architecture combinations). So the only other way would be native compilation (can't help you with that, sorry).
InstallBuilder allows you to easily distribute Java applications and bundle a JVM (although itself does not require Java, so as you mention you will never get errors because the end user does not have a JVM in the machine). It is a commercial product (diclaimer, I am the original developer) but we have discounts for small ISVs and free licenses for open source projects. It is in use by MySQL/Oracle, Jaspersoft, Alfresco, Pentaho and a bunch of other ISVs with Java-based tools and those apps have been downloaded literally millions of times with no major issues. Give it a try :)
In general, you have a few options:
1) Java Web Start
2) Run it as an applet
3) download and install.
You are primarily interested in option 3. You have a variety of installers (InstallJammer is one, but you have others) that you can create installation packages for. Since you are looking at distributing the JVM (which you can do), then you are looking at different installer for every platform you are targeting.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With