rpm -qa |grep java
rpm -qa |grep jdk
rpm -qa |grep gcj
rpm -qa | grep java | xargs rpm -e --nodeps
yum update -y
yum list java-1.8*
# yum install java-1.8.0-openjdk* -y
java -version
返回信息如下,说明安装成功
提示 command not found
报错:
说明环境除了问题,此时需要找到OpenJDK的安装位置,将其配置到/etc/profile文件中:
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.392.b08-2.el7_9.x86_64
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=$CLASSPATH:.:${JAVA_HOME}/lib:${JAVA_HOME}/jre/lib
export PATH=${JAVA_HOME}/bin:${JAVA_HOME}/jre/bin:$PATH
这是我的OpenJDK的安装位置