安装jdk

1.下载jdk:wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u141-b15/336fa29ff2bb4ef291e347e091f7f4a7/jdk-8u141-linux-x64.tar.gz"

2.解压:tar xzf jdk-8u141-linux-x64.tar.gz

3.配置环境变量:vim /etc/profile,在文件末尾加入:

JAVA_HOME=/usr/java/jdk1.8.0_141

CLASSPATH=$JAVA_HOME/lib/

PATH=$PATH:$JAVA_HOME/bin

export PATH JAVA_HOME CLASSPATH

4.按esc  :wq保存退出

5.source /etc/profile

6.查看是否安装成功:

出现如下内容表示安装成功

java version "1.8.0_141"

Java(TM) SE Runtime Environment (build 1.8.0_141-b15)

Java HotSpot(TM) 64-Bit Server VM (build 25.141-b15, mixed mode)

7.删除安装包:rm -rf jdk-8u141-linux-x64.tar.gz

你可能感兴趣的:(安装jdk)