First, uninstall the original openjdk
- rpm -qa | grep java
After that, it will show all the uninstall, I have here is five
- rpm -e --nodeps java-1.7.0-openjdk-1.7.0.111-2.6.7.2.el7_2.x86_64
- rpm -e --nodeps java-1.7.0-openjdk-headless-1.7.0.111-2.6.7.2.el7_2.x86_64
- rpm -e --nodeps python-javapackages-3.4.1-11.el7.noarch
- rpm -e --nodeps javapackages-tools-3.4.1-11.el7.noarch
- rpm -e --nodeps tzdata-java-2016h-1.el7.noarch
Finally, through a rpm -qa | grep java to see if there is content, if not, the instructions to uninstall and clean.
Second, install the sun jdk
1, the local jdk download from Oracle's official website.
2, the local downloaded jdk reached the virtual machine
- scp jdk-8u102-linux-x64.tar.gz [email protected]:/opt/
3, decompression
- tar -xvf jdk-8u102-linux-x64.tar.gz
4, configure the environment variables
- vi / etc / profile
1 JAVA_HOME=/opt/jdk1.8.0_102
2 export JAVA_HOME
3 export PATH=$PATH:$JAVA_HOME/bin
- source / etc / profile (a profile to take effect)
5. Verify
- java -version