Can the installer autodetect if there is an existing Java(tm) installation in the system?

asked 06 Sep '11, 09:17

Jake's gravatar image

Jake ♦♦
181533174
accept rate: 98%

edited 12 Sep '11, 04:23


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:

  • vendor: sun (to allow only Sun Microsystems JREs,) ibm (to allow only IBM JREs) or empty (to allow any JRE.)
  • minVersion:Minimum supported version of the JRE. Leave empty to not require a minimum version.
  • maxVersion: Maximum supported version of the JRE. Leave empty to not require a maximum version. If specified only with major and minimum version numbers then it will match any number in the series. For example, 1.4 will match any 1.4.x version (1.4.1, 1.4.2, ...) but not a 1.5 series JRE.
  • requireJDK: Whether to require that the Java(tm) installation needs to be a JDK. By default, it is set to 0 so either a JDK or JRE will work.

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.

link

answered 06 Sep '11, 09:23

Jake's gravatar image

Jake ♦♦
181533174
accept rate: 98%

edited 15 Sep '11, 10:31

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×12
×3
×1

Asked: 06 Sep '11, 09:17

Seen: 176 times

Last updated: 15 Sep '11, 10:31

powered by BitNami OSQA