使用yum安装
001、查看安装包
[root@localhost test]# cat /etc/redhat-release CentOS Linux release 7.9.2009 (Core)
002、查看java8安装包
[root@localhost test]# yum list java-1.8*
003、查看当前java
[root@localhost test]# java -version openjdk version "1.8.0_345" OpenJDK Runtime Environment (build 1.8.0_345-b01) OpenJDK 64-Bit Server VM (build 25.345-b01, mixed mode) [root@localhost test]# javac -version bash: javac: command not found... Similar command is: 'java'
004、安装java8
yum install java-1.8.0-openjdk.x86_64 yum install java-1.8.0-openjdk-devel.x86_64
005、查看安装效果
[root@localhost test]# java -version openjdk version "1.8.0_345" OpenJDK Runtime Environment (build 1.8.0_345-b01) OpenJDK 64-Bit Server VM (build 25.345-b01, mixed mode) [root@localhost test]# javac -version javac 1.8.0_345
参考:https://blog.csdn.net/qq_40605511/article/details/122590227
标签:java,root,1.8,centos7,version,test,安装,java8,localhost From: https://www.cnblogs.com/liujiaxin2018/p/16774597.html