Download the JDK Compression pack installation directly
Divided into the following 5 steps
1. Download the JDK on the website
2. Unzip and drop to the specified directory
3. Configure Environment variables
4. Set the system default JDK
5. Test the JDK
1. Download JDK Address: http://www.oracle.com/technetwork/articles/javase/index-jsp-138363.html
Select the appropriate. gz package to download
2. Unzip and place in the specified directory (take jdk-7u60-linux-x64.gz as an example)
To create a directory:
sudo MKDIR/USR/LIB/JVM
Add compression to the directory:
sudo tar-zxvf jdk-7u60-linux-x64.gz-c/USR/LIB/JVM
3. Modify the Environment variables:
sudo vim ~/.BASHRC
Append the following to the end of the file:
#set Oracle JDK Environment
Export java_home=/usr/lib/jvm/jdk1.7.0_60 # # Note here to replace the directory with your own extracted JDK directory export JRE_HOME=${JAVA_HOME}/JRE export Classpath=.:${java_home}/lib:${jre_home}/lib export Path=${java_home}/bin: $PATH
Make environment variables effective immediately
SOURCE ~/.BASHRC
4. Set the system default JDK version
sudo update-alternatives--install/usr/bin/java java/usr/lib/jvm/jdk1.7.0_60/bin/java sudo Update-alternatives--install/usr/bin/javac Javac/usr/lib/jvm/jdk1.7.0_60/bin/javac sudo Update-alternatives--install/usr/bin/jar jar/usr/lib/jvm/jdk1.7.0_60/bin/jar sudo update-alternatives-- Install/usr/bin/javah javah/usr/lib/jvm/jdk1.7.0_60/bin/javah sudo update-alternatives--install/usr/bin/ JAVAP JAVAP/USR/LIB/JVM/JDK1.7.0_60/BIN/JAVAP 300
Then execute:
sudo update-alternatives--config java
If you install the JDK for the first time, you will be prompted
There is only one alternative in link Group Java (Providing/usr/bin/java):
/usr/lib/jvm/jdk1.7.0_60/bin/java
No, choose the right JDK
5. Test the JDK
Java-version
Java Version "1.7.0_60"
Java (TM) SE Runtime Environment (build 1.7.0_60-b19)
Java HotSpot (TM) 64-bit Server VM (build 24.60-b09, Mixed mode)
JDK Installation succeeded
Ubuntu two kinds of installation Jdk7 JDK8 way to complete the introduction
Ubuntu Installation JDK 7