1. Download the jdk tar package
##2 , Uninstall the jdk that comes with the system
Because the CentOS7.4 system I installed here comes with jdk1.8, so I need to uninstall the jdk that comes with the system firstView the current system jdk Version:java -version
## List packages matching installed java:
yum list installed | grep java
Uninstall jdk:
yum -y remove java-1.7.0-openjdk* yum -y remove java-1.8.0-openjdk*
Create a new java folder in /usr/, mkdir java uses Xftp to upload the downloaded jdk-8u211-linux-x64.tar.gz to /usr/java , need
chmod 777 /usr/java
to decompress the package:
tar -zxvf jdk-8u211-linux-x64.tar.gz
##Use vim /etc/profile to edit the profile file input :
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
centos tutorial
The above is the detailed content of How to download jdk in centos. For more information, please follow other related articles on the PHP Chinese website!