1.下载
http://download.oracle.com/otn-pub/java/jdk/8u112-b15/jdk-8u112-linux-x64.rpm
2.安装
rpm -ivh jdk-8u112-linux-x64.rpm
3.配置环境变量
gedit ~/.bashrc
加入如下五行:
JAVA_HOME=/usr/java/jdk安装路径
JAVA_BIN=/usr/java/jdk安装路径/bin
PATH=$PATH:$JAVA_HOME/bin
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export JAVA_HOME JAVA_BIN PATH CLASSPATH
4.创建链接
cd /usr/bin
ln -s -f /usr/local/jdk安装路径/jre/bin/java
ln -s -f /usr/local/jdk安装路径/bin/javac