Home >Operation and Maintenance >CentOS >How to download jdk in centos
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*3 , install the downloaded 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 , need
chmod 777 /usr/java
to decompress the package:
tar -zxvf jdk-8u211-linux-x64.tar.gz4. Configure environment variables
##Use vim /etc/profile to edit the profile file input :
vim /etc/profilePress i to enter the editing mode, and append the following content to the file:
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:$PATHAfter editing is completed, press Esc and enter: wq to exitSave and exit. At this time, the environment variable To take effect, you need to execute
source /etc/profileecho to check whether it takes effect
echo $JAVA_HOME /usr/java/jdk1.8.0_211After the environment variables are set, enter: java, javac, java -version and it is normal to be able to access the content. Recommended tutorial:
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!