Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is ant looking for tools.jar in the wrong dir? [duplicate]

Tags:

java

ant

I am trying to execute `ant -version' and I get

C:\Users\owner>ant -version
Unable to locate tools.jar. Expected to find it in C:\Program Files\Java\jre7\lib\tools.jar
Apache Ant(TM) version 1.8.4 compiled on May 22 2012

I checked all of my environment variables and I cant find a reference to C:\Program Files\Java\jre7

I have the JDK and JRE installed at C:\Program Files (x86)\Java\jre7 and C:\Program Files (x86)\Java\jdk1.7.0_10

I also have stuff in C:\Program Files\Java\jre7 and C:\Program Files\Java\jdk1.7.0_10

Can anyone tell me why ant is looking in the wrong directory?

I have seen a bunch of other questions on stackoverflow but none of them solve my issue.

output of %path% is

C:\Users\owner>echo %path%
%CommonProgramFiles%\Microsoft Shared\Windows Live;C:\Windows\system32;C:\Window
s;C:\Windows\System32\Wbem;C:\Program Files (x86)\CyberLink\Power2Go;C:\Program
Files (x86)\ATI Technologies\ATI.ACE\Core-Static;c:\Program Files (x86)\Microsof
t SQL Server\90\Tools\binn\;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Window
s\System32\WindowsPowerShell\v1.0\;C:\Program Files\Java\jdk1.6.0_24\bin;C:\Prog
ram Files\TortoiseSVN\bin;C:\Program Files (x86)\Java\jdk1.7.0_10;C:\Program Fil
es (x86)\Android\android-sdk\tools\apache-ant-1.8.4\bin;C:\Program Files (x86)\A
ndroid\android-sdk\platform-tools\;C:\Program Files (x86)\Android\android-sdk\to
ols\;C:\Program Files\Common Files\Microsoft Shared\Windows Live

C:\Users\owner>echo %JAVA_HOME%
%ProgramFiles(x86)%\Java\jdk1.7.0_10
like image 519
DiverseAndRemote.com Avatar asked Dec 20 '12 03:12

DiverseAndRemote.com


1 Answers

Ant does (unfortunately) rely on the JAVA_HOME system property. You will want to make sure that this property points to a valid JDK installation (and not a JRE).

like image 57
Perception Avatar answered Nov 09 '22 22:11

Perception