Skip to Content

<installedJREs>

Scope: JDT projects

Description

The installedJREs type allows you to define several Java Runtime Environments (JREs) that are available in your build environment. Ant4Eclipse uses these definitions to resolve the so called Java System Library that is part of each JDT-based project. To define a JRE, you just have to provide a name and the path to the JRE. Ant4Eclipse automatically detects the version of the defined JRE as well as the corresponding JARs. It is also possible to define a default JRE. If you haven't chosen a specific JRE in the build path of your project, the default JRE will be taken.

Note: Please make sure that your JREs have the same names as defined in your eclipse IDE (Window->Preferences..., Java->Installed JREs). Otherwise Ant4Eclipse may is not able to resolve the JRE System Library of a given project.

Arguments

The installedJREs datatype provides the following arguments:

Argument Description Required
default The id of a jre that should be used as the default JRE no

Nested Elements

A JRE must be defined using the nested jre element that allows the following arguments:

Argument Description Required
id The name of the JRE as specified within the Eclipse preferences. yes
location The filesystem location of the corresponding JRE root directory. yes
extDirs The filesystem location of the java.ext.dirs. This parameter is only used if no fileset with JARs has been specified. no
endorsedDirs The filesystem location of the java.endorsed.dirs. This parameter is only used if no fileset with JARs has been specified. no

Example usage

Let's say you're generally using the following VM's in your Eclipse environment (the VM's are configured within Eclipse under Preferences->Java->Installed JREs):

  • JRE 1.4 named as JDK_1_4 (C:\jdks\jdk1.4.2)
  • JRE 1.5 named as JDK_1_5 (C:\jdks\jdk1.5.0)
  • JRE 1.6 named as JDK_1_6 (C:\jdks\jdk1.6.0)

Now you have JRE 1.4 as the default one but some projects do require 1.5 or 1.6. This can be configured using the following setup:

<ant4eclipse:installedJREs default="JDK_1_4">
    <jre id="JDK_1_4" location="C:\jdks\jdk1.4.2"/>
    <jre id="JDK_1_5" location="C:\jdks\jdk1.5.0"/>
    <jre id="JDK_1_6" location="C:\jdks\jdk1.6.0"/>
  </ant4eclipse:installedJREs>

That would make the JDKs JDK_1_5 and JDK_1_6 available for projects that have the corresponding org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/<id> entry in their .classpath file and JDK_1_4 available for projects that
have the org.eclipse.jdt.launching.JRE_CONTAINER on their classpath.