I\'m using Ant 1.7.0 and installed java 1.6 which is in JAVA_HOME.
I want to build a project using java 1.5, so I\'ve exported JAVA_HOME to be my java 1.5 directory.
Use the following 2 properties for javac tag:
javac
fork="yes" executable="full-path-to-the-javac-you-want-to-use".
Explaination of the properties can be found here