Check whether to install OpenJDK
java -version
openjdk version "1.8.0_222"
OpenJDK Runtime Environment(build 1.8.0_222-b10)
OpenJDK 64-Bit Server VM(build 25.222-b10, mixed mode)
View installation location
rpm -qa | grep java
javamail-1.4.6-8.el7.noarch
python-javapackages-3.4.1-11.el7.noarch
tzdata-java-2019b-1.el7.noarch
javapackages-tools-3.4.1-11.el7.noarch
java-1.8.0-openjdk-headless-1.8.0.222.b10-0.el7_6.x86_64
java-1.8.0-openjdk-1.8.0.222.b10-0.el7_6.x86_64
javassist-3.16.1-10.el7.noarch
java-1.8.0-openjdk-devel-1.8.0.222.b10-0.el7_6.x86_64
Execute statement to delete openjdk
rpm -e --nodeps java-1.8.0-openjdk-headless-1.8.0.222.b10-0.el7_6.x86_64
rpm -e --nodeps java-1.8.0-openjdk-1.8.0.222.b10-0.el7_6.x86_64
rpm -e --nodeps java-1.8.0-openjdk-devel-1.8.0.222.b10-0.el7_6.x86_64
Check to delete
java -version
- bash:/usr/bin/java: No such file or directory
Download jdk-8u221-linux-x64.tar.gz from the official website.
After downloading, upload to the server via ftp.
Create a directory, unzip
mkdir /usr/java
tar zvxf jdk-8u221-linux-x64.tar.gz -C /usr/java
Environment configuration, modify the profile file
vi /etc/profile
Add to
export JAVA_HOME=/usr/java/jdk1.8.0_221
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
Make environment variables take effect
source /etc/profile
Check if the configuration is successful
java -version
java version "1.8.0_221"Java(TM) SE Runtime Environment(build 1.8.0_221-b11)
Java HotSpot(TM)64-Bit Server VM(build 25.221-b11, mixed mode)
Recommended Posts