Linux下JDK1.8升级到JDK12

文章目录

  • 环境
  • JDK12下载
  • 修改配置

环境

现有环境是jdk1.8,因某个程序运行要求是jdk11+,所以尝试将jdk进行升级操作

[root@manager crate-4.1.2]# 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)

JDK12下载

官网:http://jdk.java.net/archive/

下载地址:https://download.java.net/java/GA/jdk12/33/GPL/openjdk-12_linux-x64_bin.tar.gz

修改配置

[root@manager crate-4.1.2]# find / -name java
/home/java
/home/java/jdk1.8.0_121/bin/java
/home/java/jdk1.8.0_121/jre/bin/java
/etc/pki/ca-trust/extracted/java
/etc/pki/java

修改/etc/profile文件

# JAVA_HOME=/home/java/jdk1.8.0_121
JAVA_HOME=/home/java/jdk-12.0.2
PATH=$JAVA_HOME/bin:$PATH
CLASSPATH=$JAVA_HOME/lib/

export JAVA_HOME PATH CLASSPATH

使用source指令使修改生效

[root@manager jdk-12.0.2]# source /etc/profile
[root@manager jdk-12.0.2]# java -version
java version "12.0.2" 2019-07-16
Java(TM) SE Runtime Environment (build 12.0.2+10)
Java HotSpot(TM) 64-Bit Server VM (build 12.0.2+10, mixed mode, sharing)

你可能感兴趣的:(Linux,linux)