set JAVA_HOME in windows but "ant build" still fails

0

3

I've set JAVA_HOME in my Windows environment preferences:

echo %JAVA_HOME%  
C:\Program Files (x86)\Java\jdk1.6.0_20

However whenever I try to run ant build I get the following:

Perhaps JAVA_HOME does not point to the JDK.
It is currently set to "C:\Program Files\Java\jre6"

I think the registry key JAVASOFT is interfering with my environment variable, but I'm not sure.

patrickinmpls

Posted 2010-06-04T18:07:39.943

Reputation: 1 193

Answers

1

I needed to copy the Tools.jar file from the jdk/lib folder to the jre/lib folder.

patrickinmpls

Posted 2010-06-04T18:07:39.943

Reputation: 1 193

ockquote>

I needed to copy the Tools.jar file from the jdk/lib folder to the jre/lib folder. Nice , it works !!! but just I want to know why ? why this does it work ?

– None – 2011-10-11T09:49:12.903

2

JAVA_HOME should be set to C:\Program Files\Java in the Command Prompt. You can do this with the following:

set JAVA_HOME=C:\Program Files\Java

This will then look for the most current jdk, lib, jre installed on your system.

j4mt

Posted 2010-06-04T18:07:39.943

Reputation: 21

1

OK, guys, for Windows 7 it needs the JAVA_HOME as a Windows Environmental Variable, I've also added C:\Program Files\Java\jdk1.7.0_03\ and C:\Program Files\Java\jdk1.7.0_03\bin to PATH, restarted Eclipse, now it works

Also - when javac refers to java classes from the JDK, it needs the main SDK folder, not the bin, the bin is only for the javac.exe, while the main folder has \include\ and other stuff necessary for compilation.

Atanas Rusev

Posted 2010-06-04T18:07:39.943

Reputation: 11

0

Does seting your PATH variable to include your JAVA_HOME help?

set PATH=%JAVA_HOME%\bin;%PATH%

Paul Jowett

Posted 2010-06-04T18:07:39.943

Reputation: 1