2

I want to install Apache ant on windows. Here is some information below:

I followed its descriptions and step by step but it still cannot work. I think the entire environment variables I set are correct. May please someone helps me? And some copies from cmd.

C:\>echo %ANT_HOME%
C:\Program Files\apache-ant-1.9.4

C:\>echo %JAVA_HOME%
C:\Program Files\Java\jdk1.6.0_34

C:\>java -version
java version "1.6.0_34"
Java(TM) SE Runtime Environment (build 1.6.0_34-b04)
Java HotSpot(TM) Client VM (build 20.9-b04, mixed mode, sharing)

C:\>ant 
is not recognized as an internal or external command,operable program or batch file.

My Ant version is 1.9.4

Community
  • 1
  • 1
apss1943
  • 269
  • 1
  • 3
  • 17
  • Rather than linking to some generic manuals / questions: describe what exactly you have done and what happens when you attempt to run ant. Thanks. – reto Nov 04 '14 at 07:51
  • Did you include the bin directory in the path? – Iootu Nov 04 '14 at 07:54
  • Thanks for your advice and edit. I wanna use metro in web service. Before it I need install apache ant. – apss1943 Nov 04 '14 at 08:02
  • I think I include bin in there. Here is part of my path variable C:\>echo %PATH% ;C:\Program Files\apache-ant-1.9.4\bin;C:\Program Files\Java\jdk1.6.0_34\bin – apss1943 Nov 04 '14 at 08:04
  • Please add these details as a proper edit to your question. What happens when you try to execute `ant`? – reto Nov 04 '14 at 08:33
  • When I typing ant in cmd. It can not execute. This command " ant -Dtomcat.home={Tomcat Installation Directory} -f metro-on-tomcat.xml install " – apss1943 Nov 04 '14 at 08:43
  • Please add these details as a proper edit to your question. Define "it can not execute". Do you get an error? – reto Nov 04 '14 at 08:55
  • cmd --> ant --> is not recognized as an internal or external command,operable program or batch file. – apss1943 Nov 04 '14 at 09:01

3 Answers3

6

I think the path is not set properly.

set JAVA_HOME=C:\Program Files\Java\jdk1.7.0
set ANT_HOME=D:\software\apache-ant-1.9.4
set PATH=%PATH%;%JAVA_HOME%\bin;%ANT_HOME%\bin

Edit: fixed PATH definition

iguana007
  • 15
  • 1
  • 8
madz
  • 168
  • 2
  • 11
0

Change your path From:
C:\Program Files\apache-ant-1.9.4
C:\Program Files\Java\jdk1.6.0_34

To:
C:\Progra~1\apache-ant-1.9.4
C:\Progra~1\Java\jdk1.6.0_34

When setting the paths.

0

Change you path , not install on C:\Program Files\

Add Path, like:

set PATH=%PATH%;%JAVA_HOME%\bin;%ANT_HOME%\bin
teo van kot
  • 12,350
  • 10
  • 38
  • 70