1、下载jdk压缩包
$ wget http://download.oracle.com/otn-pub/java/jdk/8u144-b01/090f390dda5b47b9b721c7dfaa008135/jdk-8u144-linux-x64.tar.gz?AuthParam=1502696435_5571ce7f047149139d996be08ed9e54e
2、创建jdk目录
$ sudo mkdir -p /usr/local/jvm
3、解压jdk到指定目录
$ sudo tar zxvf jdk-8u144-linux-x64.tar.gz -C /usr/local/jvm
4、设置环境变量
# ubuntu 变量环境文件 $ sudo vim ~/.bashrc # centos 变量环境文件 $ sudo vim /etc/profile
---------------------------------------->
# set java's path export JAVA_HOME=/usr/local/jvm/jdk1.8.0_144 export JRE_HOME=${JAVA_HOME}/jre export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib export PATH=${JAVA_HOME}/bin:$PATH
5、使用配置生效
$ source ~/.bashrc
6、查询版本信息
$ java -version