Each Eclipse JDT-project usually contains an entry specifying the JRE or Execution Environment that should be used when compiling the project. This classpath entry is a "library" entry with a path starting with org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType
followed by the name of your JRE or Execution Environment. The name is specified in Eclipse when you register a JRE via Window -> Preferences -> Java -> Installed JREs or an Execution Environment (via Window -> Preferences -> Java -> Installed JREs -> Execution Environments):
If you have a JRE with the name "jdk_15" configured (as in the screenshot above) and have added it to your build path, the appropriate classpath entry would look like this:
<classpath> ... <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk_15"/> ... </classpath>
Unfortunatly the JRE definitions are not stored in your project, so ant4eclipse cannot access them. To make sure ant4eclipse can correctly resolve your JREs you must set them up in your build file using the installedJREs
type. This type contains a number of jre
sub-elements that take two attributes: an id
, that must match the name you have specified in Eclipse for a JRE. The second attribute, location
must point to the root directory of the matching JRE installation. To configure the "jdk_15" that is shown in the screenshot above, you have to add the following lines to your build file:
<ant4eclipse:installedJREs> <jre id="jdk_15" location="r:/jdk_15" /> </ant4eclipse:installedJREs>
If you have specified in your build an Execution Environment instead of a concrete JRE, ant4eclipse automatically discovers the best matching JRE out of all JREs you have specified with installedJREs
. If you want to force ant4eclipse to use a specific JRE for an Execution Environment, use the name of Execution Environment as the id attribute in the jre attribute.
Example:
If you're using the "J2SE-1.5" Execution Environment in your project, you're classpath contains the following entry:
<classpath> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> </classpath>
jre
definition:<ant4eclipse:installedJREs> <jre id="J2SE-1.5" location="r:/jdk_15" /> </ant4eclipse:installedJREs>