Can the installer autodetect if there is an existing Java(tm) installation in the system?
Yes, you can make the installer autodetect whether or not there is an existing Java(tm) installation in the system by using an <autodetectJava>
action. If a suitable Java(tm) is found, the action will also create a number of variables, described later on. This action is usually placed at the <preInstallationActionList>
and if no valid JRE or JDK is found, the installer will abort with an error listing the supported JREs and JDKs. The following example will select any Sun Microsystems JRE 1.3 or newer (for example, 1.3, 1.4, 1.5) or any IBM JRE with version number equal or greater than 1.4.2 but inside the 1.4 series (1.5 will not work at this time).
<autodetectJava>
<validVersionList>
<validVersion>
<vendor>sun</vendor>
<minVersion>1.4.2</minVersion>
<maxVersion>1.4</maxVersion>
</validVersion>
<validVersion>
<vendor>ibm</vendor>
<minVersion>1.3</minVersion>
<maxVersion></maxVersion>
</validVersion>
</validVersionList>
</autodetectJava>
Each element in the <validVersionList>
contains the following fields:
Upon successful autodetection, the following installer variables will be created :
${java_
executable}: Path to the java(tm) command line binary (java.exe in Windows). For example /usr/bin/java, C:\Program Files\Java\j2re1.4.2_
03\java.exe.
${java_
version}: For example, 1.4.2_
03
${java_
version_
major}: For example, 1.4
${java_
vendor}: sun or ibm.