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.

Related posts: