1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| # 检查是否已经存在java相关命令 rpm -qa|grep java rpm -qa|grep jdk rpm -qa|grep gcj
# 如果需要卸载 rpm -qa | grep java | xargs rpm -e --nodeps
# 检索Java1.8源列表 yum list java-1.8*
# 安装Java1.8 yum install java-1.8.0-openjdk* -y
# 查询JAVA_HOME which java
# 返回 /usr/bin/java
# ls -l命令 ls -l /usr/bin/java
# 返回 lrwxrwxrwx 1 root root 22 Nov 13 14:37 /usr/bin/java -> /etc/alternatives/java
# ls -l命令 ls -l /etc/alternatives/java
# 返回 lrwxrwxrwx 1 root root 73 Nov 13 14:37 /etc/alternatives/java -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.272.b10-1.el7_9.x86_64/jre/bin/java
# 则JAVA_HOME路径为:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.272.b10-1.el7_9.x86_64
|