How to Add JAVA_HOME

JAVA_HOME is a system variable used by Sun Microsystems' Java JDK software development kit. The JDK is responsible for writing and running Java applications. The JAVA_HOME variable allows applications to find the JDK without having to specify the exact path for every system. It also allows you to install the JDK software in a non-default location. It must be added to the Operating System's system variables after the JDK is installed.

Things You'll Need

  • Java JDK
Show More

Instructions

  1. Windows

    • 1

      Click on "Properties" under "My Computer."

    • 2

      Select the "Advanced" tab.

    • 3

      Click on "Environmental Variables."

    • 4

      Type the path to the Java JDK folder next to "JAVA_HOME". The default location is "C:\Program Files\Java|jdk<version>." Replace <version> with the version number of the installed JDK.

    Linux/Unix

    • 5

      Open the file "~/.bashrc" in any text editor.

    • 6

      Add the following two lines to the ".bashrc" file:
      export JAVA_HOME=/usr/java/jdk<version>/bin/java
      export PATH=$PATH:/usr/java/jdk<version>/bin
      Replace <version> with the version number of the installed JDK.

    • 7

      Save and close the file.

    • 8

      Open a terminal window. The terminal window will be found in the operating system's main "Application" menu, under either "System Tools" or "Utilities". You will be presented with a command prompt.

    • 9

      Type "echo $JAVA_HOME" (no quotes) to test your configuration.

Tips & Warnings

  • If you installed the JDK in a non-default location, specify the new location when defining the variable.

Related Searches:

References

Comments

You May Also Like

Related Ads

Featured