Possible Duplicate:
Override the compiler attribute in an Ant javac task
In Ant, how exactly do I use the build.compiler option, or the <javac> task‘s compiler attribute?
I tried setting compiler="javac1.5", but when I opened the resulting class-file in a hex editor, the class version was still shown as 32 hex (version 1.6) — until I set JAVA_HOME to point to my JDK 1.5 installation. (Until then, it had been pointing to my JDK 1.6 installation.) So it seems like JAVA_HOME supersedes the compiler attribute — in which case, what is the purpose of that attribute?
The source and target attributes do seem to work correctly; when I specify the target version, the resulting class-file does have the right version.
The purpose of the attribute is to be able to choose something like
gcjorjikesinstead of the standard JDK compiler.javac1.5(andjavac1.6etc.) is just an alias formodern, the standard compiler, and is defined simply to support the rule that the default value ofbuild.compilerisjavac1.xwithxmatching the running JDK (so the default ismodernon 1.3 and higher andclassicon 1.2 and below).If you want to compile classes that will run on 1.5 then you need to use
source="1.5" target="1.5"and also set the bootstrap classpath to point to a 1.5 class library, to ensure you aren’t calling methods that were introduced in 1.6 or later.