Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
799 views
in Technique[技术] by (71.8m points)

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

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%in directory to the PATH system variable

Open System Properties -> Advanced -> Environment Variables
Under system variables, select PATH and append ;%ANT_HOME%in
    e.g. %SystemRoot%system32;%SystemRoot%;%JAVA_HOME%in;%ANT_HOME%in

Verify that ANT is installed.

Open a new command window and type:
C:>ant -v`

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

My exact path variable is %SystemRoot%system32;%SystemRoot%;%JAVA_HOME%in;%SystemRoot%System32Wbem;%SYSTEMROOT%System32WindowsPowerShellv1.0;%JAVA_HOME%in;%ANT_HOME%in 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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...