Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

‘ant’ is not recognized as an internal or external command

Tags:

path

windows

ant

I have the same issue as this user: ant - not recognized as an internal

however unfortunately none of the solutions have worked for me in that post or any other. I've also looked at other commands not recognized and specifically adding a path variable. The procedure I am using is as follows:

Extract to a desired installation directory, e.g. C:\apache-ant Create an ANT_HOME environment variable`  Open System Properties -> Advanced -> Environment Variables Create a new system variable     Variable name: ANT_HOME     Variable value: C:\apache-ant   Add %ANT_HOME%\bin directory to the PATH system variable  Open System Properties -> Advanced -> Environment Variables Under system variables, select PATH and append ;%ANT_HOME%\bin     e.g. %SystemRoot%\system32;%SystemRoot%;%JAVA_HOME%\bin;%ANT_HOME%\bin  Verify that ANT is installed.  Open a new command window and type: C:\>ant -v` 

In my case the Variable value is C:\apache-ant\apache-ant-1.8.2.

My exact path variable is %SystemRoot%\system32;%SystemRoot%;%JAVA_HOME%\bin;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;%JAVA_HOME%\bin;%ANT_HOME%\bin which doesn't have any spaces between semicolons.

However testing the ant installation does not work, the picture below is what I'm experiencing:

enter image description here

I have tried restarting on numerous occasions to no avail. I have run out of ideas, so if anyone has any any information would be helpful. Thanks!

EDIT

Posted results of dir:

enter image description here

like image 312
user1152440 Avatar asked Feb 13 '12 15:02

user1152440


People also ask

How do I know if Ant is installed Windows 10?

Check your installation by opening a command line and typing ant -version into the commend line. The system should find the command ant and show the version number of your installed Ant version.


2 Answers

ANT_HOME is not being resolved. Change %ANT_HOME%\bin in the Path system environment variable to c:\apache-ant\apache-ant-1.8.2\bin.

like image 130
Adam Bruss Avatar answered Oct 19 '22 04:10

Adam Bruss


I had a similar issue, but the reason that %ANT_HOME% wasn't resolving is that I had added it as a USER variable, not a SYSTEM one. Sorted now, thanks to this post.

like image 24
Joshua Avatar answered Oct 19 '22 04:10

Joshua