This article address: http://www.cnblogs.com/archimedes/p/ubuntu-jdk8.html, reprint please indicate source address.
1, download the latest JDK installation, address: http://www.oracle.com/technetwork/java/javase/downloads/
2, decompression jdk-8u20-linux-x64.gz, I decompression and placed under the/OPT
sudo tar zxvf./jdk-8u20-linux-x64.gz -c/opt
3. Configure Environment variables
Vim ~/.BASHRC
Press Shit+g to add the following to the end of the file
Export JAVA_HOME=/OPT/JDK1. 8 . 0_20export jre_home=${java_home}/JRE export CLASSPATH=.:${java_home}/lib:${jre_home}/Lib Export PATH=${java_home}/bin: $PATH
Exit save and run the following command to make it effective
SOURCE ~/.BASHRC
4. Configure the default JDK
Since some Linux already have their own JDK, we need to set up the JDK we just installed as the default JDK, which can be configured below.
sudo update-alternatives--install /usr/bin/java java/opt/jdk1. 8 - sudo update-alternatives--install /usr/bin/javac javac/opt/jdk1. 8 -
The effect is as follows:
If you are prompted not to find the path, restart and try again.
5. Testing
Start the terminal and enter the following command
Java-Versionjavac
The effect is as follows:
Now that the JDK is installed
Ubuntu 14.04 under Install JDK8