| |
|
|
APPLICATION INSTALLERS
Application installers are a critical piece of many software distribution efforts, particularly for
Java desktop applications. The installer is the first part of the application the customer
sees. If the installer does not work correctly end users will often give up and refuse to try to
troubleshoot the issue. It is thus critical that installation is as painless as possible.
Java Web Start: The default choice
The default choice for installation of Java applications is often
Java Web Start. Java Web Start provides
the ability to download and launch applications from a web page, and to download and install the correct
Java Runtime Environment (JRE) if needed. Once an application has been downloaded it can run
offline from a cached version. Java Web Start can also download updated versions of the application
jar files, thus fulfilling the roles of installer and
automatic updater. Java Web Start is
based on, and is an implementation of, the Java Network Launching Protocol (JNLP). Web Start is,
of course, produced and supported by Sun Microsystems and is free.
Despite the advantages of Java Web Start it is not the only installer option. In fact, it is
technically not an installer at all, as indicated in this passage from the
JNLP Specification version 6.0:
1.1 Web-centric Application Model
A JNLP Client is an application or service that can launch applications on a client system from
resources hosted across the network. It is not a general installation protocol for software
components.
In other words, Java Web Start is a network application launcher rather than a full application
installer. Java Web Start has several advantages and is the best choice for many applications, but
there are some trade-offs. The issues with Web Start fall into three main categories:
- Installation of Web Start itself, and the right JRE, is sometimes problematic. This very much
depends on who your users are.
- Web Start is not designed to handle the 'permanent' installation of files or native components
onto a person's machine. Instead it's designed to pull such elements from the
internet and cache them on disk. You lose some control of installation
location this way, as well as the ability to register subcomponents with the OS and provide
conventional uninstallation procedures.
- Web Start launches your application in a generic Java process, rather than naming the process
after your application.
Sun has been working hard to solve these issues, particularly the first one. The difficultly lies
with users who do not have a JRE installed on their computer. In this case they do not have Java
Web Start installed either, so clicking on a JNLP link does not work. Web pages hosting Web Start
applications require a difficult, browser-specific block of JavaScript just to allow the
user to understand the problem be directed to Sun's site to download a JRE. This is a separate,
large download requiring the user to agree to a separate license agreement. In other words, it's a
barrier to getting your application running that some users may not cross.
Things are improving. Java Web Start is included in all JREs since version 1.4. Java is standard
on Mac OS X, is included with most distributions of Linux, and is now included with most new
machines that have Windows pre-installed. Recent estimates state that Java is present on 90% of all
desktop machines. Sun also has several initiatives to ease the installation process including a
set of browser plugins to handle installation (as opposed to the awkward JavaScript block currently
used), a simpler licensing agreement dialog, and a smaller initial download size for the JRE. These
welcome initiatives are moving in the right direction, but some will not be released until early
2008, and they will take time to diffuse out into the desktop ecosystem. In the meantime application
developers must weight the pros and cons of Java Web Start vs. a more conventional application
installation. For Java applications to compete against native desktop applications it is important
not to assume that Java must be presented in some completely platform-native way and cannot use a
conventional application installer. Of course, it is possible to have multiple ways to use an
application available from the same site, including a Java Web Start launching button and an option
to download and run a conventional installer. This way users can choose the technique that works
for them.
Despite the issues with Java Web Start, it has the built-in capability to automatically
update your application using either timestamps or version numbers. Auto-updating is an important
function, and with Web Start this is built-in and free.
Toolsets for deployment: Launchers, Installers, & Installer Generators
Let's clarify our terminology for the numerous tools available:
- Launcher: A wrapper around a JAR file that launches a
process and runs the Java application within that process.
- Installer: A program that writes a Java application
and all files needed to run it (including a launcher) to disk, and performs any OS
configuration desired (such as creating desktop icons).
- Installer Generator: Creates native installation
programs (and native launchers) for multiple platforms.
Launchers
If your application runs in it's own
process (such as a standard desktop application) then a launcher provides several benefits. It can
check the JRE version to ensure there are no version conflicts before launching the Java application
within the JRE. It can also use native code to rapidly present a splash screen before the JRE loads,
though as of Java 1.6 this is also a built-in feature of the JRE.
One of the most important benefits of a launcher is the ability to register itself as a standard
application within the operating system
(OS) so the OS grant special permissions to your application, rather than to the Java runtime. It
can name the OS process after your application, and register your company as the publisher of the
application. This means users can identify the process running your application as yours, rather
than seeing multiple generic "java" processes running on their computer. This is especially important
when the OS gives security warnings related to the application, or if the user needs to find the
application process in the the process list (task list in Windows). Obviously, if your application
needs special permissions to run and the user becomes confused about which application is making
the request they will probably deny the request, preventing your application from operating
correctly.
There are many programs that can generate a native launcher for your Java application. However,
most installer generators (see below) will also create a launcher. Buying a separate launcher
generator is not usually necessary.
Installers
An installer is optional. The alternative is to simply provide all files as a compressed or
self-extracting file and let the user unpack it in their directory of choice. This works well for
software developers but is not suitable for many consumer-level applications. Installers provide
a number of features beyond simply extracting the program files:
- Detect installed JREs to ensure the proper JRE is present, and download and install it if
necessary.
- Create desktop icons and OS-level menu items for launching the program.
- Register the program and its uninstaller with the OS.
- Allow the user to configure the installation directories.
- Require the user to agree to a license agreement.
- Give the user multiple configuration options (such as languages, minimal vs. full install, etc.).
- Write configuration data to the user directory, registry, etc.
- Run aribitrary scripts during installation.
- Install a program as a service.
Interestingly, Java Web Start provides the first two of these features, but not the rest.
There are a number of installer programs written in Java. That is, the installer itself is a Java
program. This creates an obvious problem: if the user does not have Java on their machine they
cannot run the installer. This is the classic "install the installer" problem, and it is the reason
why the installation program the user downloads should be written in native code for their platform.
The installer can then detect the user's JRE and download and install a correct JRE before launching
your Java application. Java Web Start suffers from the install the installer problem. The way to
create a native installation program for every platform is to use an installer generator.
Installer Generators
An installer generator is an application that creates an installer for your software product. The
best installer generators will create a native launcher and a native installer for every major
platform. They should also be easy to integrate into your build process, usually by providing an
Ant task or Maven Mojo. Once configured, you should be able to run a build that compiles and
packages your Java application and then creates a native installer for every major platform. This
should happen automatically on a full build with no manual intervention required. Some installer
generators even create a web page for you to help you distribute the correct installer to each
visitor.
A critical point to note is that, unlike Java Web Start, most installer genertors do not provide
automatic updating out-of-the-box. Instead it must be added using an additional tool and, quite
often, custom programming.
Links
Java Web Start Info and Documentation
Java Web Start official site
Java Web Start Wikipedia entry
Java Web Start Guide
Java Web Start FAQ
JNLP Specification
Excellent examples of how to use Web Start features at PhySci
Java Web Start Controversies
Keith Lea Blog Entry
Kyle Cordes Blog Entry
Diego Doval Blog Entry (see Thomas Ng's extensive response in the comments).
Roedy Green's Mindprod entry on installing and repairing Java Web Start
Open-source Launchers & Installers
List of open-source installer generators at java-source.net
JSmooth
Launch4J
Commercial Installer Generators
Advanced Installer by Caphyon
Install4J by ej-technologies
InstallAnywhere by Macrovision
JExpress by DeNovo
JNLPWrapper by Duck Creek Software
MakeInstall by Duckware
One final note: we do not advocate using any particular technology. Rather, we prefer to put all of
the available options on the table for you to evaluate. Enjoy.
|