• Post Reply Bookmark Topic Watch Topic
  • New Topic

Unable to access Apache Ant from Command Prompt  RSS feed

 
Arindam Biswas
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Sir,
I have Window Operating System. I download apache-ant-1.9.2-bin.zip in my local folder C:\apache-ant-1.9.2 . I set the Environment Variables as follows:


ENVIRONMENT VARIABLES

User Variables for ARINDAM BISWAS

Varaible Value

ANT_HOME C:\apache-ant-1.9.2\bin\bin

Sysyem Variables


Variable Value

JAVA_HOME C:\Java\jre1.6.0_05

In the the Command Promt while i am testing to access the ant by
C:\>ant -version
i am getting error :
'ant' is not recognized as an internal or external command, operable program or batch file.
But, i am able to access java by writing the command

C:\>java -version
Installation directory of jre and jdk in my local folder is:

C:\Java\jdk1.6.0_05

C:\Java\jre1.6.0_05.
Please let me know what I went wrong and how could I access Apache Ant from Command Prompt.

Regards,
Arindam Biswas.
 
Tony Docherty
Bartender
Posts: 3271
82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.

If you want to be able to run ant from the command line without have to give the path to the ant installation you need to add its path to the PATH environment variable. As you have already defined an environment variable called ANT_HOME with this information you can add %ANT_HOME% to the PATH environment variable.
 
Arindam Biswas
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Sir,
Not very clear how to access from Command Prompt. My installation directory of java C:\Java\jdk1.6.0_05\jre. My installation directory of ant C:\apache-ant-1.9.2. How could I set Environment Variable? Do I need both User Variable and Sysyem Variable to set?
Regards,
Arindam Biswas.
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think there's only a single environment variable called PATH, and it should already exist. Just append ";%ANT_HOME%" to it.

If you search for "set environment variable windows" you should find tutorials that show you how. That has nothing to do with Java or Ant.

ANT_HOME C:\apache-ant-1.9.2\bin\bin

That looks odd with the double "bin" at the end - is that correct? All the more so because in my Ant installation ANT_HOME points to the root Ant folder, not to the bin folder that's inside of it.
 
Arindam Biswas
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Sir,
I set the User Variable as follows:

Variable name: ANT_HOME
Variable value: C:\apache-ant-1.9.2\bin

Variable name: JAVA_HOME
Variable value: C:\Java\jdk1.6.0_05\jre

Variable name: PATH
Variable value: %JAVA_HOME%\bin;%ANT_H0ME%\bin;%path%

While I test from Command Prompt with command ant, I get the error: "ANT_HOME is set incorrectly or ant could not be located.Please set ANT_HOME". I am still not clear how I could set ANT_HOME correctly.
Arindam Biswas
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:All the more so because in my Ant installation ANT_HOME points to the root Ant folder, not to the bin folder that's inside of it.
 
Arindam Biswas
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you sir. You are right. I got the solution.
Arindam Biswas.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!