Classpath / Resource issues

Self-Extracting Jar

AntInstall supports delivering the installation package as a self extracting Jar. In Windows if the Java installer from Sun has been used and the default application for files that end in .jar has not been changed, double clicking on the Jar will launch the installer. To launch from the command line type
> java -jar [installer_name].jar

If all classes are packaged in a single Jar everything is on the same classpath, this is useful for almost all situations. However, if your installer absolutely requires separate classpaths, for example if custom tasks have clashing dependencies, the classpath must be defined as it would in a normal Ant build. To achieve this you will have to package the Jars in a self-extractor or, for the non-extractor, extract the Jars to temporary space first.

If delivering an installer on a CDROM there is no need to package the installer as a single Jar. In which case the following applies.

Install Scripts

For Linux installations.
It is recommended to tar and gzip the components with the execute permissions) script in the root of the archive. The user should the run (or double click on) the script after uncompressing the archive to a temporary directory. This is a generally understood method, for Linux it is tipical to include a README or INSTALL file with simple instructions i.e. "run the install script and follow instructions". Also creating a copy of the script and calling it ./configure will help users used to installing with ./configure;make;make install who don't read your documents.

For Window$ installations.
For windows installations it is better to use the ZIP compression format. The demo app includes an example of a windows start script (install.cmd) that will set the classpath for the installer.

Java required.
Currently both example install scripts rely on a system property called %JAVA_HOME% since this is standard for most Java deployments. If this is a problem get in touch and I can write some scripts to check standard locations for the Java binary. It is also possible to deliver Java with your app, but you will need to check with the Sun licenses as to weather this is permitted or not, and users will have a heafty download.
It may be better to specify the Java command as just java or javaw for windows since Sun ahs made some headway ensuring that if installed the binary can be specified without the need for the full path.


The developer creating the installer should ensure that all references in the install script are correct when the script is run. In the AntInstall demo the is slightly different to the in the root directory since the libs required are in a different directory. Ensure your classpath is correct also ensure that during testing you are not useing a default Ant installed on your machine and that you bundle Ant 1.6 with the installation and all the requried Ant task libs.
It is currently possible to include a directory called antlib this will be passed to the Ant launcher with the normal ant -lib parameter.
With self extracting jars all classes should be packaged in the root of the Jar file.


A further classpath consideration is the location of the images for the GUI. They must be on the classpath when the AntInstaller runs in the /resources/ path. This can be achieved by creating a directory ./lib/resources and adding ./lib to the classpath for scripted installs. Alternatively the files can be added to a Jar file in the resources path inside the Jar for self-extractor and non-extractor builds. The installer will not fail if the resources are not available but the correct images will not be shown. Some missing resources such as the license file for a license page will fail if the resource is not available.

Java version

The required Java version is 1.4 or above. It may be possible to get AI working on 1.3 provided that the JGoodies look and feel is NOT used and regular expressions are not used. Also the XML parsers and APIs will have to be added to the classpath.
If regex and 1.3 are a requriement of yours, it is possible to hack the code to use the Apache regex parser included with Ant. There have been problems with this code and so it is not included by default. Please get in contact if you would like to work on this feature.
show menu