Application Installer
by Roedy Green ©1996-2009 Canadian Mind Products
This essay does not describe an existing computer program, just
one that should exist. This essay is about a suggested
student
project in Java programming. This essay gives a rough overview of how it
might work. I have
no source, object, specifications, file layouts or
anything else useful to implementing this project. Everything I have to say to
help you with this project is written below. I am
not prepared to help
you implement it; I have too many other projects of my own.
I do contract work for a living, which could include writing a program such as
this. However, I don’t do people’s homework
for them. That just robs them of an education.
You have my full permission to implement this project in any way you please and
to keep all the profits from your endeavor.
There are commercial tools like InstallShield, Wise
and InstallAnywhere to wrap your MASM, C++ and Java
applications up to make them easy to install on Windows. These schemes have the following drawbacks:
- They are outrageously expensive. They are too expensive for hobbyists or small businesses.
- They are hideously complicated. They use ugly scripting languages that grew like Topsy without plan.
- It is hard to do anything out the ordinary. You need clumsy mechanisms to insert your stub code.
- They are not as smooth as they could be for the end user, particularly in picking directory names. It should be very
easy to take the default suggested name, but on a different drive. It should be easy to take the default suggested name,
but nested in some other directory. It should allow the user to select from some most common possibilities, e.g. C:\Program Files\mindprod
or C:\mindprod .
I propose writing a set of Java installer classes. You can then use them to whip together a custom install program. You
don’t need to learn some arcane script language. If you need to do anything out of the ordinary, you have the full
power of Java at your disposal.
The classes would handle such things as:
- Identifying details about the environment we are installing into, e.g. cpu type, free space on each disk, the sort of
information need/sniff/avoid provides.
- Inserting/removing lines in autoexec.bat and config.sys.
- putting icons on the screen.
- Adding/removing system menu items.
- Verifying all files are present and accounted for and unmolested.
- Selecting a suitable drive and directory to contain the application.
- Cleaning up after the install to get rid of temp directories.
- Branding with user name and or registration keys.
- Asking the user questions about just what he wants installed and how.
- Displaying a string of entertaining *.gifs during the boring parts.
- Checking and changing the registry.
- Cleaning out aborted previous installs.
- Uninstall and registering the official uninstall.
- Automatic checks for updates with automatic install.
- Prebranded software and software rental.
- On the fly download of files if they are not already present and sufficiently up to date. you can check if package X is
already installed, and if not download and install it automatically as a precondition to your install.
- The user community of this set of classes might submit additional classes for inclusion.
You would need to compile your program with a native mode compiler so that you have all the standard java classes you
need embedded in an exe. Further, you wrap any other files you need with the installer in a self-extracting PKZIP exe.
You don’t want to rely on a working JVM being previously installed.
Alternatively, you insist that a JVM and your installer be preinstalled. It then unpacks and installs compact download
application packages.
Unfortunately the installer will likely be fatter than the app you are trying to install. Perhaps some advanced Java
compilers or optimisers could help put the installer on a diet.
The first version would focus on Windows 95/98/NT. Later you might add classes for other platforms. Ideally your
mainline program install would be more or less platform-independent.
Start with a very simple installer and gradually add features. This will keep you from being overwhelmed by detail. At
each stage you will have something useful other can test. They will provide you feedback on which features are most
important to add next.
- Use the ZIP classes to unpack a zip file to a fixed directory tree.
- Install an icon on the desktop to fire up the application.
- Install an item in the start menu to fire up the application.
- Dynamically configure to allow choice of drive.
- Dynamically configure to allow choice of directory.
- Allow reinstallation of the icons and menut items if they are damaged, without disturbing anything else.
- Split files into program and data files, so can upgrade without disturbing data files.
- Run a custom install program after files are in place.
- Allow changes/additions to the registry.
The other half of installing is maintaining an application with automatic updates. See the Automatic
File Updater project.