Loading

centos7卸载openjdk,安装oraclejdk

查看JDK版本

java -version

查找openjdk安装包

rpm -qa | grep openjdk

卸载openjdk

yum -y remove java*openjdk*

获取oraclejdk

本地安装RPM

sudo yum localinstall jdk-11.0.9_linux-x64_bin.rpm

设置环境变量

  • vim /etc/profile
  • 末尾添加
JAVA_HOME=/usr/java/jdk-11.0.9
PATH=$JAVA_HOME/bin:$PATH
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export JAVA_HOME
export PATH
export CLASSPATH
  • source /etc/profile

再次执行java -version查看当前Java版本

java version "11.0.9" 2020-10-20 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.9+7-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.9+7-LTS, mixed mode)

如何在CentOS上安装RPM软件包

posted @ 2020-12-12 14:01  mahoshojo  阅读(190)  评论(1编辑  收藏  举报