If you look at the file "ant.bat" , you will see that it looks for the command "java" as follows:
- If the
%JAVACMD% environment variable is set, it uses it. - Otherwise, if the
%JAVA_HOME% environment variable is set, it tries to use %JAVA_HOME%\bin\java.exe - Otherwise, it tries to use
java.exe ; that is, it will look at your% PATH%.
In your case, you have %JAVA_HOME% set ... but it is installed in the "bin" installation directory in Java, and not in the installation root directory. So Ant.bat script looks in the wrong place for java.exe .
Just set %JAVA_HOME% correctly and it should work.
JAVA_HOME C:\Program Files\Java\jdk1.7.0_06
You do not need to have a Java “bin” directory on your %PATH% for Ant to work, but it’s a good idea anyway. This way you can run Java commands just from the command line.
The setting %CLASSPATH% does not apply to this problem. In fact, if the build.xml file does not work, Ant will ignore the %CLASSPATH% environment variable.
Stephen c
source share