下载JDK
$ wget http://download.oracle.com/otn-pub/java/jdk/8u144-b01/090f390dda5b47b9b721c7dfaa008135/jdk-8u144-linux-x64.tar.gz?AuthParam=1508222327_d097b2a11646c016bdccea2d7708ea44
解压到目录
$ sudo mkdir /opt/java/
$ sudo chown zhujun /opt/java
$ mv jdk-8u144-linux-x64.tar.gz\?AuthParam\=1508222327_d097b2a11646c016bdccea2d7708ea44 jdk-8u144-linux-x64.tar.gz
$ tar zxvf jdk-8u144-linux-x64.tar.gz -C /opt/java
修改环境变量
$sudo vim /etc/profile
export JAVA_HOME=/opt/java/jdk1.8.0_144
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
立即更新
$ source /etc/profile
查看结果
$ java -version