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

前端 未结 9 1264
囚心锁ツ
囚心锁ツ 2020-12-13 13:22

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\

相关标签:
9条回答
  • 2020-12-13 13:24

    Had the same problem. The solution is to add a \ at the end of %ANT_HOME%\bin so it became %ANT_HOME%\bin\

    Worked for me. (Should be system var)

    0 讨论(0)
  • 2020-12-13 13:25

    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.

    0 讨论(0)
  • 2020-12-13 13:26

    even with the environment variables set, I found that ant -version does not work in scripts. Try call ant -version

    0 讨论(0)
  • 2020-12-13 13:34

    I downloaded ant (http://ant.apache.org/bindownload.cgi), unzipped to my C drive, and used the windows 'doskey' command:

    doskey ant=C:\apache-ant-1.9.6\bin\ant.bat $*
    

    this will work as long as you use the same command console, to make it permanent is more difficult: http://darkforge.blogspot.com/2010/08/permanent-windows-command-line-aliases.html

    0 讨论(0)
  • 2020-12-13 13:37

    create a script including the following; (replace the ant and jdk paths with whatever is correct for your machine)

    set  PATH=%BASEPATH%
    set ANT_HOME=c:\tools\apache-ant-1.9-bin
    set JAVA_HOME=c:\tools\jdk7x64
    set PATH=%ANT_HOME%\bin;%JAVA_HOME%\bin;%PATH%
    

    run it in shell.

    0 讨论(0)
  • 2020-12-13 13:40

    When Environment variables are changed log off and log in again so that it will be applied.

    0 讨论(0)
提交回复
热议问题