jdk下载地址:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
jdk解压
tar -zxf jdk-8u131-linux-x64.tar.gz -C /usr/local/
配置环境变量
JAVA_HOME=/usr/local/jdk1.8.0_131
JRE_HOME=/usr/local/jdk1.8.0_131/jre
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin:$HOME/bin:/sbin:/usr/bin:/usr/sbinexport:/usr/local/sbin:/usr/local/bin:/bin:/usr/sbin:/root/bin
CLASSPATH=.:$JAVA_HOME/lib/jt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
export JAVA_HOME JRE_HOME PATH CLASSPATH
使环境变量生效
source /etc/profile