CentOS 安装 JRE 9

1.  首先去官网查询最新的jre的下载地址,然后用wget命令下载:

wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "https://download.oracle.com/otn-pub/java/jdk/8u191-b12/2787e4a523244c269598db4e85c51e0c/server-jre-8u191-linux-x64.tar.gz"

2. 创建安装目录

sudo mkdir -p /usr/local/java

3. 解压文件到安装目录

sudo tar -zxvf serverjre-9.0.1_linux-x64_bin.tar.gz -C /usr/local/java/ --strip-components=1

4. 添加命名空间

sudo vim /etc/profile
# JDK configuration

export JAVA_HOME=/usr/local/java
export JRE_HOME=${JAVA_HOME}
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH

# End JDK configuration

5. 使命名空间生效

source /etc/profile

6. 测试

java -version
posted @ 2018-02-23 22:30  白马黑衣  阅读(645)  评论(0编辑  收藏  举报