0

I get following error when I run ant command in cmd prompt

 D:\>ant
Unable to locate tools.jar. Expected to find it in C:\Program Files\Java\jre6\li
b\tools.jar
Buildfile: build.xml does not exist!
Build failed

I have to develop a phonegap application for andriod device .

I have set JAVA_HOME as C:\Program Files\Java\jdk1.6.0_41; under system variables

and Path as C:\Program Files\Java\jdk1.6.0_41\bin

in system variables

My ant path is C:\Program Files\apache-ant-1.9.3\bin; in system variables Path

Values in my Path System variables are as seen below

%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;"C:\Program Files\Common Files\EMC";C:\Program Files\Java\jdk1.6.0_41\bin;D:\username-Software\Android\sdk\platforms;D:\username-Software\Android\sdk\platform-tools;C:\Program Files\apache-ant-1.9.3\bin;D:\username-Software\Android\sdk\tools;
user3313210
  • 59
  • 1
  • 9

2 Answers2

1

build.xml does not exist: did you run ant command in directory where build.xml is located? You may create it first - learn how to do it in ant tutorial

tools.jar: run java -version. It may happen that some other java have preference in PATH variable. You might need to fine-tune PATH variable. Java binary is often copied to c:\windows (aka system32). Try to add JAVA_HOME\bin to start of PATH variable

Leos Literak
  • 8,805
  • 19
  • 81
  • 156
0

I had the same problem a year ago because i've installed two different JDK that appears in my PATH. check this

"Unable to locate tools.jar" when running ant

Community
  • 1
  • 1
Kraiss
  • 919
  • 7
  • 22
  • I have got this in my PATH system variables %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;"C:\Program Files\Common Files\EMC";C:\Program Files\Java\jdk1.6.0_41\bin;D:\username-Software\Android\sdk\platforms;D:\username-Software\Android\sdk\platform-tools;C:\Program Files\apache-ant-1.9.3\bin;D:\username-Software\Android\sdk\tools; – user3313210 Feb 28 '14 at 10:41
  • No where is two path for java\bin is set as per your post – user3313210 Feb 28 '14 at 10:42
  • 1
    java often is copied to c:\windows (aka system32) – Leos Literak Feb 28 '14 at 10:43
  • 1
    Try to add JAVA_HOME\bin to start of PATH variable. – Leos Literak Feb 28 '14 at 10:44
  • Now after adding JAVA_HOME to the start I get just Buildfile: build.xml does not exist! Build failed – user3313210 Feb 28 '14 at 10:48
  • Well, question author accepts the answears, not responder :-). The other one is mine and there is info about build failed message with link to tutorial – Leos Literak Feb 28 '14 at 10:58
  • Yes i can respond but your answer is better that's why i vote it up ;) – Kraiss Feb 28 '14 at 11:02