Java Reference
In-Depth Information
L ISTING 7.1 Continued
* main method
public static void main(String[] args) {
CDLauncher CDLauncher1 = new CDLauncher();
From Listing 7.1 we can see that all the action takes place during the installer thread execution
(the run method beginning at line 207). Such a thread is created and launched at lines 197-198.
The install method (beginning at line 169 in Listing 7.1) will begin the physical installation
of the specified files. Depending on the selected options it can bring up a customization dialog
in order to let the user directly choose the modules to be installed (see Figure 7.4). For simplic-
ity, in such a dialog the first item is always intended to be necessary to every installation and it
cannot de-selected (it is thought to be the core module). The physical installation is performed
by the copy method, starting at line 236.
The installJre method (beginning at line 259 of Listing 7.1) takes care of executing the
proper installation executable (located in a particular directory on the CD-ROM, depending on
the supported platform ). In this implementation only Windows machines are supported. For
adding support to install the needed JRE on other platforms it is enough to extend the
installJre method.
When needing some special installation activity, you can subclass the CDLauncher class provid-
ing your own implementation of the installCustom method at line 278 of Listing 7.1. In this
way for example, platform-dependent installation directives could be enforced by means of
native code invoked by this method (for example to write some application installation data in
the Windows Registry). This method provides the flexibility you may need and that general-
purpose installers (even if more sophisticated) may not have.
Method loadProperties (beginning at line 123 of Listing 7.1) loads the configuration file
( ,reported in Listing 7.4 below) that specifies the installation data.
Finally, note that the statement at line 219 of Listing 7.1 is not needed in production code and
should be deleted.
Search WWH ::

Custom Search