First, download
First of all, of course it is to download.
Address: http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
Select a different version as needed. The author chooses the jdk-7u45,
Second, decompression
Unzip the downloaded. tar.gz file.
Use the following command to extract:
sudo tar zxvf./jdk-7u45-linux-x64.tar.gz
For ease of administration, you can move the extracted files to another folder.
You can do it without doing it.
The author moved the file to the/opt/java/jdk/directory.
To facilitate the next set of environment variables, change the folder to a short name--jdk1.7
You can rename a folder by using the following command
sudo mv jdk1.7.0_45/jdk1.7/
Third, set environment variables
Edit the. bashrc file.
Enter the following command at the terminal:
VI ~/.BASHRC
At the end of the file, add the following lines of code:
Export java_home=/opt/java/jdk/jdk1.7 export Classpath=${java_home}/libexport path=${java_home}/bin: $PATH
In order for the changes to take effect immediately, execute the following command at the terminal:
SOURCE ~/.BASHRC
P.S. It is best to back up the backup command before modifying the. bashrc file:
CP. BASHRC. bash_original
Iv. Verification
With the above steps, the JDK is installed.
Enter the following command to verify the java-version ,
Ubuntu Install Java