Setting JAVA_HOME

Describes how to set JAVA_HOME on Windows or UNIX systems.

The JAVA_HOME environment variable points to the directory where the Java runtime environment (JRE) is installed on your computer.

The following tasks provide the information you need to set JAVA_HOME on Windows or UNIX systems.

To set JAVA_HOME on a Windows system:

  1. Open File Explorer, right click This PC, and then select Properties.

  2. On the System > About page, click Advanced system setting.

  3. On the System Properties page, click Environment Variables.

  4. On the Environment Variables, under System Variables select JAVA_HOME and click Edit.

  5. On the Edit System Variable page, then Variable Value, specify the location of the Java Runtime Environment (JRE).

    For example, you might specify: C:\Program Files\Java\jdk1.8\jre

    JRE is part of the Java Development Kit (JDK) but can be downloaded separately.

  6. Click OK.

To set JAVA_HOME on a UNIX system:

For Korn and bash shells, specify:

export JAVA_HOME=jdk-install-dir
export PATH=$JAVA_HOME/bin:$PATH

For a Bourne shell, specify:

JAVA_HOME=jdk-install-dir
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH

For a C shell, specify:

setenv JAVA_HOME jdk-install-dir
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH
setenv PATH $JAVA_HOME/bin:$PATH
export PATH=$JAVA_HOME/bin:$PATH