By default, your bundles will be compiled with whichever JRE is
being used to run the build and with source and target levels set to
1.3 and 1.2.
PDE build is capable of configuring the JRE used during compilation
on a per bundle basis. To take advantage of this, the first thing
to do is to tell PDE build which JREs you have available. In your
build configuration build.properties file, set properties to point to
each of your installed JREs. The template build.properties
provided in org.eclipse.pde.build/templates/headless-build has a list
of environments commented out. Simply uncomment the properties
for which you have JREs and set the value to be the set of jars that
belong on the boot classpath. For example, setting the property:
will compile bundles requiring java 1.5
against rt.jar and jsse.jar. The names of the properties should
match the names of the environments that PDE Build knows
about.
PDE Build will automatically set the source and target levels for each
environment. The environments that PDE builds knows and their
associated source/target levels are as follows:
Environment |
Source |
Target |
CDC-1.0/Foundation-1.0 |
1.3 |
1.1 |
CDC-1.1/Foundation-1.1 |
1.3 |
1.2 |
OSGi/Minimum-1.0 |
1.3 |
1.1 |
OSGi/Minimum-1.1 |
1.3 |
1.2 |
JRE-1.1 |
1.1 |
1.1 |
J2SE-1.2 |
1.2 |
1.1 |
J2SE-1.3 |
1.3 |
1.1 |
J2SE-1.4 |
1.3 |
1.2 |
J2SE-1.5 |
1.5 |
1.5 |
JavaSE-1.6 |
1.6 |
1.6 |
PersonalJava-1.1 |
1.1 |
1.1 |
PersonalJava-1.2 |
1.1 |
1.1 |
CDC-1.0/PersonalBasis-1.0 |
1.3 |
1.1 |
CDC-1.0/PersonalJava-1.0 |
1.3 |
1.1 |
CDC-1.1/PersonalBasis-1.1 |
1.3 |
1.2 |
CDC-1.1/PersonalJava-1.1 |
1.3 |
1.2 |
<buildDirectory>/plugins/bundleA/
META-INF/manifest.mf: Bundle-RequiredExecutionEnvironment: CDC-1.0/Foundation-1.0, J2SE-1.3
build.properties: jre.compilation.profile=J2SE-1.4
<buildConfiguration>/
build.properties: J2SE-1.3=C:/Java1.3/jre/lib/rt.jar;C:/Java1.3/jre/lib/i18n.jar
J2SE-1.4=C:/Java1.4/jre/lib/rt.jar;C:/Java1.4/jre/lib/jsse.jar
In the above setup, the list of
environments considered (in order) is: J2SE-1.4,
CDC-1.0/Foundation-1.0, J2SE-1.3. The bundle can run on
CDC/Foundation and J2SE-1.3, but for some reason, it should be
compiled with J2SE-1.4. In this case, J2SE-1.4 is set in the
build configuration and comes first in the list of environments, so it
is used to compile the bundle. The source and target levels used
in this case are 1.3 and 1.2. If instead, the build configuration
defined only J2SE-1.3 and not J2SE-1.4, then J2SE-1.3 would be the only
environment on the list for which a JRE is available, so it would be
used to compile the bundle. In that case, the source and target
levels would be 1.3 and 1.1.