Windows 7 -ANT_HOME is set incorrectly or ant could not be located. Please set ANT_HOME
ant, java
Solution
You have ANT_HOME set 2 times :
- as User environment variable ANT_HOME=%ANT_HOME%\bin
- as System environment variable ANT_HOME=C:\ant-apache-1.9.3
Set ANT_HOME=C:\ant-apache-1.9.3 either as User variable OR as System variable but not both ! Afterwards put %ANT_HOME%\bin to your System Path variable
ANT_HOME has to be set to the rootfolder of your Ant installation => C:\ant-apache-1.9.3 in your case, it's similar to setting JAVA_HOME. Including \bin is wrong !
Test your ant installation via cmd :
C:\Users\someuser>ant
Buildfile: build.xml does not exist!
Build failed
=> OK For more details about your ant installation use :
C:\Users\someuser>ant -diagnostics
------- Ant diagnostics report -------
Apache Ant(TM) version 1.9.3 compiled on December 23 2013
-------------------------------------------
Implementation Version
-------------------------------------------
core tasks : 1.9.3 in file:/C:/ant193/lib/ant.jar
-------------------------------------------
ANT PROPERTIES
-------------------------------------------
ant.version: Apache Ant(TM) version 1.9.3 compiled on December 23 2013
ant.java.version: 1.7
Is this the Apache Harmony VM? no
Is this the Kaffe VM? no
Is this gij/gcj? no
ant.core.lib: C:\ant193\lib\ant.jar
...
Problem
Hi All, I set ANT_HOME path but while trying to use ant -version i get the error "ANT_HOME is set incorrectly or ant could not be located. Please set ANT_HOME" Attached pic for reference. Pls help.