Download jdk-8u152-linux-x64.rpm or jdk-8u152-linux-x64.tar.gz (select the corresponding package according to the number of bits of your system)
As shown in the picture:
The steps to install jdk are as follows:
Because the CentOS7.4 system I installed comes with jdk1.8, so in order to demonstrate how To install jdk, I need to uninstall the jdk that comes with the system first
Check the current system jdk version:
java -version
List the software packages that match the installed java :
yum list installed | grep java
(Recommended tutorial: centos usage tutorial)
1. Uninstall the installed jdk:
yum -y remove java-1.7.0-openjdk* yum -y remove java-1.8.0-openjdk*
2. Install jdk
Create a new java folder in /usr/, mkdir java uses Xftp to upload the downloaded jdk-8u211-linux-x64.tar.gz to /usr/java, chmod 777 /usr/java
# is required. ##3. Unzip the package:tar -zxvf jdk-8u211-linux-x64.tar.gz
vim /etc/profile
export JAVA_HOME=/usr/java/jdk1.8.0_211 export JRE_HOME=$JAVA_HOME/jre export CLASSPATH=$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
source /etc/profile
echo $JAVA_HOME /usr/java/jdk1.8.0_211
The above is the detailed content of How to download jdk in centos system. For more information, please follow other related articles on the PHP Chinese website!