ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rob Hills" <>
Subject Building Java code with a different version
Date Tue, 08 Mar 2005 13:44:49 GMT
Hi All,

I'm struggling with a build script that needs to be able to compile and jar java code 
against different JDKs, depending on a property setting.

>From my reading of the Ant docs, I should be able to use either the build.compiler 
property or the compiler attribute to specify which JDK I want the java source compiled 
with.  In my situation it's either 1.4 or 1.5.

My build machine has the JAVA_HOME environment variable pointing to the JDK 1.5 
version and this always seems to be used to compile the code, regardless of what I do 
with the "build.compiler" property or "compiler" attribute.

I've been trying to set the "build.compiler" property within my ant script - will this work,
can this only be set via an ANT_OPTS commandline option?  In any case, if I leave out 
the build.compiler property and just set the "compiler" attribute to "javac1.4", I still get

classes compiled using JDK 1.5.

I suspect I'm misunderstanding something here, can anyone set me right?


Rob Hills
Waikiki, WA
Mobile (0412) 904-357
Fax: (08) 9529-2137

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message