1, download jdk8
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
2, create a directory
sudo mkdir /usr/lib/jvm
Jdk directory and extract to the top
sudo tar -zxvf jdk-8u74-linux-x64.tar.gz -C /usr/lib/jvm
3, modify the system environment variables
sudo vim ~/.bashrc
or sudo gedit ~/.bashrc
Files added at the end:
Oracle JDK Environment #set
Export the JAVA_HOME = / usr / lib / JVM / jdk1.8.0_191
Export the JRE_HOME the JAVA_HOME = $ {} / JRE
Export the CLASSPATH =:. $ {the JAVA_HOME} / lib: $ {} the JRE_HOME / lib
Export the PATH = $ {JAVA_HOME} / bin: $ PATH
effect immediately variable
source ~/.bashrc
4, test whether the normal installation
java -version
java version "1.8.0_191"
Java(TM) SE Runtime Environment (build 1.8.0_191-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode)