Please set java.home to a JDK installation

Problem:
c:\glassfish>lib\ant\bin\ant -f setup.xml Unable to locate tools.jar. Expected to find it in C:\Program Files\Java\jre6\lib\tools.jar

Buildfile: setup.xml

all:

get.java.home:

setup.init:

check-java:

get.java.home:

setup.init:

validate-java:

[echo] Current Java Version 1.6.0_10

BUILD FAILED
C:\glassfish\setup.xml:156: The following error occurred while executing this line:
C:\glassfish\setup.xml:136: The following error occurred while executing this line:
C:\glassfish\setup.xml:132: Please set java.home to a JDK installation

The problem is: Unable to locate tools.jar. Expected to find it in C:\Program Files\Java\jre6\lib\tools.jar

Solutions:

Step 1: set JAVA_HOME environment variable to your JDK install directory

Step 2: restart cmd window, stupid windows doesn't recognize it before cmd window is restarted.

Category >> Real Methods  
If you want someone to read your code, please put the code inside <pre><code> and </code></pre> tags. For example:
<pre><code> 
String foo = "bar";
</code></pre>

  1. Santosh Shetty on 2010-7-8

    Thanks alot for the solution I was knowing Step1 but step2 stupid windows ….worked for me 🙂

  2. Manikandan on 2011-10-19

    Thanks..I also have same problem now it resolved..

  3. Larissa on 2011-10-29

    Thank you. Problem is now resolved.

  4. samyraj on 2012-9-2

    hi,

    because of cmd prompt i searched lot. aftre that i have restarted build successfull.thanks..

  5. ordinary guy on 2015-1-13

    Thanks for step 2 about restarting cmd, spend a lot of time to figure out what is happening in this awesome Windows system. Huge thanks!

Leave a comment

*