wget http://download.oracle.com/otn-pub/java/jdk/8u121-b13/e9e7ea248e2c4826b92b3f075a80e441/jdk-8u121-linux-x64.tar.gz
我是直接安装在 opt 目录下,目录没有什么要求自己选择就行了,不要忘记就好了,
root@iZ28v:~# cd /opt root@iZ28v:~# tar -zxvf jdk-7u60-linux-x64.gz
root@iZ28v:~# vim ~/.bashrc
#set oracle jdk environment export JAVA_HOME=/opt/jdk8 ## 这里要注意目录要换成自己解压的jdk 目录 (如果你是用软链接的方式,这直接写软链接) export JRE_HOME=${JAVA_HOME}/jre export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib export PATH=${JAVA_HOME}/bin:$PATH
使环境变量马上生效
source ~/.bashrc
root@iZ28v:~# java -version java version "1.8.0_121" Java(TM) SE Runtime Environment (build 1.8.0_121-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13,mixed mode)
jdk 安装成功