Here's an illustration of how you might fetch the Java 5 boot classes location from an environment variable, then use it.
First, set the environment variable - say JAVA5_BOOTCLASSES
.
The property
task gives you access to the environment, then the bootclasspath
argument of the javac
task passes the setting to the compiler.
<property environment="env" />
<property name="java5.boot.classpath" value="${env.JAVA5_BOOTCLASSES}" />
<javac source="1.5" target="1.5"
bootclasspath="${java5.boot.classpath}"
...
/>
Note that if the environment variable is not set, Ant will ignore it and proceed without - so the compiler will fall back to the default boot classpath.
Another option, if appropriate, is to switch off the warnings, and not bother with the bootclasspath. Something like
<javac srcdir= ... >
<compilerarg arg="-Xlint:-options" />
</javac>
But that's likely to expose you to some subtle bugs.