Do you want to install Java Home? The Java Home variable is typically written like this: JAVA_HOME, and is installed in the Java folder.
Method 1 of 2: Windows
Step 1. Suppose the Java Development Kit (JDK) is installed in the default folder, namely C:\ Program Files \ Java. This folder contains the JDK, for example version jdk1.6.0_06. Thus, the folder of interest to us is: C: \ Program Files \ Java \ jdk1.5.0_08.
Step 2. Install JAVA_HOME using My Computer
- Right-click on the My Computer icon (on the desktop) and select Properties from the menu.
- Click on the "Advanced" tab.
- Click on Environment Variables.
- Under the System Variables section, click New.
- In the Variable Name field, enter JAVA_HOME.
- In the Variable Value field, enter C: \ Program Files \ Java \ jdk1.6.0_06.
- Click OK.
- Click OK again.
- Restart your computer for the changes to take effect.
Step 3. Install JAVA_HOME using the command line
- Open command prompt
At the command prompt, enter
set JAVA_HOME = C: \ Program Files \ Java \ jdk1.6.0_06
and press Enter. JAVA_HOME is installed.
Method 2 of 2: Linux
Step 1. To set JAVA_HOME use.bash_profile, which is the startup script (runs commands when the user logs in)
To install JAVA_HOME do the following:
Login to your account and open the.bash_profile file
$ vi ~ /.bash_profile
If the path to the Java folder is /usr/java/jdk1.6.0_06/bin/java, then set JAVA_HOME as follows:
export JAVA_HOME = / usr / java / jdk1.6.0_06 / bin / java
- Save and close the file. Restart your computer for the changes to take effect.
To check for the presence of JAVA_HOME on Windows, type
C: \> echo% JAVA_HOME%
The following message will be displayed:
C: \ Program Files \ Java \ jdk1.6.0_24
To check for the presence of JAVA_HOME on Linux, type
$ echo $ JAVA_HOME
- On Linux,.bash_profile runs Bash shell commands and.bashrc runs new Bash shell commands. When editing.bash_profile, you are setting JAVA_HOME for one user; to do this for all users, edit the global settings in / etc / profile or /etc/bash.bashrc.