CentOS8 安装 Java JDK
1、查看已安装版本
[root@localhost bin]# rpm -qa|grep jdk jdk-1.7.0_80-fcs.x86_64 jdk1.8.0_121-1.8.0_121-fcs.x86_64
2、删除已安装版本
[root@localhost bin]# yum -y remove jdk1.8.0_121-1.8.0_121-fcs.x86_64
3、解压
[root@localhost opt]# tar -zxvf jdk-8u281-linux-x64.tar.gz -C /opt/java/
4、配置环境变量并检查
[root@localhost jdk1.8.0_281]# export JAVA_HOME=/opt/java/jdk1.8.0_281 [root@localhost jdk1.8.0_281]# export JRE_HOME=$JAVA_HOME/jre [root@localhost jdk1.8.0_281]# export CLASSPATH=.:$CLASSPATH:$JAVA_HOME/lib:$JRE_HOME/lib [root@localhost jdk1.8.0_281]# export PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin [root@localhost jdk1.8.0_281]# source /etc/profile [root@localhost jdk1.8.0_281]# java -version java version "1.8.0_281" Java(TM) SE Runtime Environment (build 1.8.0_281-b09) Java HotSpot(TM) 64-Bit Server VM (build 25.281-b09, mixed mode) [root@localhost jdk1.8.0_281]#