As the error message “com.sun.tools.javac.Main is not on the classpath” points out, the variable JAVA_HOME
is just used because it didn’t find the compiler class com.sun.tools.javac.Main
on the class path.
So it’s easier to include the tools.jar
of your JDK in the class path, so ant will find the class com.sun.tools.javac.Main
without depending on the environment variable.