I have installed ant(apache-ant-1.7.0). But when i run the ant command in dos command prompt, it says
‘ant’ is not recognized as an internal or external command, operable program or batch file.
where i'm going wrong.
I have installed ant(apache-ant-1.7.0). But when i run the ant command in dos command prompt, it says
‘ant’ is not recognized as an internal or external command, operable program or batch file.
where i'm going wrong.
That just means it's not on the path.
Edit your PATH environment variable to include Ant's "bin" directory. The exact steps for editing your path with depend on your operating system, but for example on XP:
Add the Ant bin directory without any quotes. Use a semi-colon to separate it from another entry. For example, you might have:
c:\Program Files\Utils;c:\Program Files\Ant 1.7\bin
For anyone that comes across this article:
Always remember, don't put a space after each semicolon.
Good:
C:\Ninja;C:\ant
Bad:
C:\Ninja; C:\ant
ant install dir
. If you haven't such, download ant
and unzip it.ant install dir
into ANT_HOMEAlso do not put a space at end of your path entry.
Good: C:\Ninja;C:\ant
Bad: C:\Ninja;C:\ant(sp)
...where (sp) represents a white space or blank. I had this and couldn't figure it out until I saw RichardJohnn's reply and then found it at the end.
Don't use Windows GUI for creating environment variables because they can mess up with the system. Easiest and best way to create a variable is creating them as local with a command script. This way they will be local and won't interfare with your system, and easier then using GUI :)
Open up a blank notepad, type the following (in case you are interested in building a Java project I added a JAVA_HOME variable as well). 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 the script and check the location with echo %ANT_HOME%.
Two Important Notes on Windows Environment Variables:
Step 1: Navigate to Advance System Setting, and then click on the advance tab there, click on environment variable button, here you can create environment variable
Step 2: In the user variable create a new variable say "ANT_HOME" and provide a path to it: For example: VARIABLE_NAME = ANT_HOME VARIABLE_value = "D:\apache-ant-1.9.6"
Step 3: Now append the path of the Ant home directory till bin in the path variable of the system variable
Now open the cmd promt and type ant, if it is still unrecognized try running the cmd promt using admin mode, it will surely work
The best way to build using ANT is in Eclipse. just type Ant in quick access box in Eclipse, Select New Java project from existing build file option. Select the XML file and the Eclipse will build it for you.
© 2022 - 2024 — McMap. All rights reserved.