The difference between OracleJDK and OpenJDK?
1. OpenJDK is the open source version of JDK
2. The licensing agreements of OpenJDK and OracleJDK are different
3. OpenJDK only contains the most streamlined JDK
JDK installation
1. Check the JDK version of the current system
[root@ops15 ~]# java -version
openjdk version “1.8.0_161”
OpenJDK Runtime Environment (build 1.8.0_161-b14)
OpenJDK 64-Bit Server VM (build 25.161-b14, mixed mode)
2. Check the jdk installation package
[root@ops15 ~]# rpm -qa | grep jdk
copy-jdk-configs-3.3-2.el7.noarch
java-1.8.0-openjdk-headless-1.8.0.161-2.b14.el7.x86_64
java-1.8.0-openjdk-1.8.0.161-2.b14.el7.x86_64
java-1.7.0-openjdk-headless-1.7.0.171-2.6.13.2.el7.x86_64
java-1.7.0-openjdk-1.7.0.171-2.6.13.2.el7.x86_64
3. Uninstall the
first type: rpm -e -nodeps xxxx the
second type: yum remove -y openjdk
Check the uninstall result
rpm -qa | grep jdk
4. To install a new JDK,
you can download jdk through wget
or upload the downloaded jdk through xftp
Installation: rpm -ivh jdk-8u181-linux-x64.rpm
After installation, check the installation path
rpm -ql jdk1.8 | more
jdk is installed in
/usr/java/jdk1.8.0_181-amd64
5. Configure environment variables (emphasis)
vim ~/.bashrc
export JAVA_HOME=/usr/java/jdk1.8.0_181-amd64
export JAVA_BIN= J A V A H O M E / b i n e x p o r t J R E H O M E = JAVA_HOME/bin export JRE_HOME= JAVAHO M E / b i n e x p o r t J R EHOME=JAVA_HOME/jre
export PATH= P A T H : PATH: PATH:JAVA_BIN
export CLASSPATH=: J A V A H O M E / l i b / d t . j a r : JAVA_HOME/lib/dt.jar: JAVAHOME/lib/dt.jar:JAVA_HOME/lib/tools.jar
Save and exit (:wq)
source ~/.bashrc makes the configuration effective immediately
6. Verify that the jdk is successfully installed
java -version