There is a project that requires Java 1.7 Mates, Java 1.8 is already installed on the original server, and the version needs to be switched to Java 1.7.
View supported Java versions of CENTOS7
yum search java|grep java-1java-1.6.0-openjdk.x86_64 : openjdk runtime environmentjava-1.6.0-openjdk-demo.x86_64 : openjdk demosjava-1.6.0-openjdk-devel.x86_64 : openjdk development environmentjava-1.6.0-openjdk-javadoc.x86_64 : openjdk api Documentationjava-1.6.0-openjdk-src.x86_64 : OpenJDK Source bundlejava-1.7.0-openjdk.x86_64 : openjdk runtime environmentjava-1.7.0-openjdk-accessibility.x86_64 : openjdk accessibility connectorjava-1.7.0-openjdk-demo.x86_64 : openjdk demosjava-1.7.0-openjdk-devel.x86_64 : openjdk development environmentjava-1.7.0-openjdk-headless.x86_64 : the openjdk runtime environment withoutjava-1.7.0-openjdk-javadoc.noarch : openjdk api documentationjava-1.7.0-openjdk-src.x86_64 : openjdk source bundlejava-1.8.0-openjdk.x86_64 : openjdk runtime environmentjava-1.8.0-openjdk-accessibility.x86_64 : openjdk accessibility connectorjava-1.8.0-openjdk-accessibility-debug.x86_64 : OpenJDK accessibility connectorjava-1.8.0-openjdk-debug.x86_64 : OpenJDK runtime environment with full debug onjava-1.8.0-openjdk-demo.x86_64 : Openjdk demosjava-1.8.0-openjdk-demo-debug.x86_64 : openjdk demos with full debug onjava-1.8.0-openjdk-devel.x86_64 : OpenJDK Development environmentjava-1.8.0-openjdk-devel-debug.x86_64 : openjdk development environment withjava-1.8.0-openjdk-headless.x86_64 : openjdk runtime environmentjava-1.8.0-openjdk-headless-debug.x86_64 : openjdk runtime environment With fulljava-1.8.0-openjdk-javadoc.noarch : openjdk api documentationjava-1.8.0-openjdk-javadoc-debug.noarch : openjdk api documentation for packagesjava-1.8.0-openjdk-src.x86_64 : openjdk source Bundlejava-1.8.0-openjdk-src-debug.x86_64 : openjdk source bundle for packages with
Installing Java version 1.7
Yum Install java-1.7.0
Use Update-alternatives to view installed Java versions
update-alternatives --listlibnssckbi.so.x86_64 auto /usr/ lib64/pkcs11/p11-kit-trust.sold auto /usr/bin/ ld.bfdmkisofs auto /usr/bin/genisoimageprint auto /usr/bin/lpr.cupsjava manual /usr/lib/jvm/ Java-1.7.0-openjdk-1.7.0.111-2.6.7.2.el7_2.x86_64/jre/bin/javajre_openjdk auto /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.111-1.b15.el7_2.x86_64/jrejre_1.8.0 auto /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.111-1.b15.el7_ 2.x86_64/jrejre_1.8.0_openjdk auto /usr/lib/ Jvm/jre-1.8.0-openjdk-1.8.0.111-1.b15.el7_2.x86_64xinputrc auto /etc/x11/xinit/xinput.d/ibUs.conflibjavaplugin.so.x86_64 auto /usr/lib64/icedteaplugin.socifs-idmap-plugin auto /usr/lib64/cifs-utils/cifs_idmap_ sss.somta auto /usr/sbin/sendmail.postfixcdrecord auto /usr/bin/wodimlibwbclient.so.0.12-64 auto /usr/lib64/samba/wbclient/libwbclient.so.0.12jre_1.7.0 auto /usr/lib/jvm/ java-1.7.0-openjdk-1.7.0.111-2.6.7.2.el7_2.x86_64/jrejre_1.7.0_openjdk auto /usr/lib/jvm/jre-1.7.0-openjdk-1.7.0.111-2.6.7.2.el7_2.x86_64
See java1.7 installed successfully, switch version to Java 1.7
Update-alternatives--config Javathere is 2 programs which provide ' Java '. Selection Command-----------------------------------------------* 1/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.11 1-1.b15.el7_2.x86_64/jre/bin/java + 2/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.111-2.6.7.2.el7_2.x86_64/jre/bin/jav Aenter to keep the current selection[+], or type selection number:2
View the Java version being used
Java-versionjava version "1.7.0_111" OpenJDK Runtime Environment (rhel-2.6.7.2.el7_2-x86_64 u111-b01) OpenJDK 64-bit Server VM (build 24.111-b01, Mixed mode)
Successfully switched to Java version 1.7.
This article is from the "focus on drilling 100 years" blog, please be sure to keep this source http://titandeng.blog.51cto.com/823817/1876678
CentOS 7 Java version switch