In the early stages of your software projects, it's a good practice to think about the distribution aspect. It doesn't matter how good a product is, if no one can perform the installation or run the application.
Generating software installers is not always easy, regardless of the installer product used.
If you're lucky enough to have a good commercial software installer, you can generate quickly packages without too much pain:
- Easy generation of application launchers.
- Good default settings with flexibility for splash screens, installer icons, pre-installation/post-installation actions, etc.
- Generation of software packages for a variety of platforms (OSX, Unix, Linux, Windows, etc.).
2 Application launchers
Now that your application development phase is complete, you may be worried about writing couple of launchers.
Writing a Java application launcher can become fairly complicated depending on :
- The amount of libraries dependencies used by the program.
- The configurations and properties to resolve or create in order to run the application properly.
- Any tasks that need to be executed prior to launching the application.
For Java based applications, below are the common steps performed by launchers scripts:
- Find the Java executable (
JAVA_HOMEdetection if needed, common locations depending on the Operating System).
- Validate the Java version requirements as well as potential optional settings.
- Setup any environment variables or system properties needed by the application.
- Construct the Java classpath from the application dependencies.
- Perform any actions need prior to launching the program.
- Invoke the Java command with the classpath and JVM arguments to start the application.
ClassWorlds is a simple Java application launcher framework that has been around for a while. It superseeded the forehead framework launcher. Forehead was used by many tools such as Maven (now using ClassWorlds).
What makes ClassWorlds compelling is that it's really easy to bootstrap an application launcher without much effort. All that Classworlds needs is a simple java command that references a boot jar file and your application configuration file(to load libraries).
3 Software Installers and packaging
Depending on the application's type, target audience and operating systems, many options are available. Commercial Software package generators usually provide good results without too much work. Decent to really good products for Java software packaging include InstallAnywhere and Install4j.
Generating software packages by hand still gives you an overall better user's installation experience at the expense of time and potential bugs (typos, logic errors, etc.).
When your installation packages are ready, you then need to test them on all supported platforms, just to be safe.
Zip distributions are very convenient for many users:
- No administration rights needed most of the time, which is useful when you don't have administrative rights on a machine.
- One step installation, just a matter of extracting a software archive.
- Easy uninstallation which is a simple folder deletion.
When generating software packages, don't forget the simple way of distributing files via zip archives.