Setting JAVA_HOME in Windows

The environment variable JAVA_HOME sets the location of your Java SDK so it can be accessed from various locations.

On Windows XP

1.
Navigate to Start > Control Panel > System.
2.
Choose the Advanced tab.
3.
Click Environment Variables.
4.
In the System Variables pane, click New.
5.
For Variable Name, type JAVA_HOME.
6.
For Variable Value, type C:\j2sdk1.5.0 for a default installation of the SDK. You may need to adjust your value based on your installation.

On Linux/UNIX

  1. Type the following code at the shell (you may need to change the location of the Java home directory for your system):

    $ export JAVA_HOME=/home/usr/jdk1.5
    
  2. To set the JAVA_HOME into the PATH, type the following:

    $ export PATH=$JAVA_HOME/bin:$PATH
    

Get Java Garage now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.