下载java8的jdk
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
# 解压 $ tar zxvf jdk-8u151-linux-x64.tar.gz # 将加压后的目录移动指定路径下(一般是/opt或者/usr/local) $ sudo mv jdk1.8.0_151 /opt/ # 添加环境变量 $ vim /etc/profile # 在文件尾部加入以下几行内容: export JAVA_HOME=/opt/jdk1.8.0_151 export JRE_HOME=${JAVA_HOME}/jre export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib export PATH=${JAVA_HOME}/bin:$PATH # 测试 $ java -version java version "1.8.0_151" Java(TM) SE Runtime Environment (build 1.8.0_151-b12) Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode)