How to Add JAVA_HOME
- 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.
- 1). Open the file "~/.bashrc" in any text editor.
- 2). 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. - 3). Save and close the file.
- 4). 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.
- 5). Type "echo $JAVA_HOME" (no quotes) to test your configuration.
Windows
Linux/Unix
Source...