1)查找java
yum -y list java*
2)切换到root先安装
[[email protected] Desktop]$ su -
Password:
[[email protected] ~]# yum install java-1.8.0-openjdk* -y
3)检查安装情况
[[email protected] ~]# java -version
openjdk version "1.8.0_131"
OpenJDK Runtime Environment (build 1.8.0_131-b11)
OpenJDK Server VM (build 25.131-b11, mixed mode)
4)安装路径
[[email protected] jvm]# cd /usr/lib/jvm
[[email protected] jvm]# ll
total 4
drwxr-xr-x. 3 root root 4096 Apr 26 06:59 java-1.8.0-openjdk-1.8.0.131-0.b11.el6_9.i386
lrwxrwxrwx. 1 root root 21 Apr 26 06:59 jre -> /etc/alternatives/jre
lrwxrwxrwx. 1 root root 27 Apr 26 06:59 jre-1.8.0 -> /etc/alternatives/jre_1.8.0
lrwxrwxrwx. 1 root root 49 Apr 26 06:59 jre-1.8.0-openjdk-1.8.0.131-0.b11.el6_9.i386 -> java-1.8.0-openjdk-1.8.0.131-0.b11.el6_9.i386/jre
lrwxrwxrwx. 1 root root 49 Apr 26 06:59 jre-1.8.0-openjdk.i386 -> java-1.8.0-openjdk-1.8.0.131-0.b11.el6_9.i386/jre
lrwxrwxrwx. 1 root root 29 Apr 26 06:59 jre-openjdk -> /etc/alternatives/jre_openjdk