Home >Operation and Maintenance >CentOS >How to download jdk in centos

How to download jdk in centos

王林
王林Original
2020-05-18 10:07:142722browse

How to download jdk in centos

1. Download the jdk tar package

How to download jdk in centos

##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 first

View the current system jdk Version:

java -version

How to download jdk in centos## 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.gz

4. Configure environment variables

##Use vim /etc/profile to edit the profile file input :

 vim /etc/profile

Press 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:$PATH

After editing is completed, press Esc and enter: wq to exit

Save and exit. At this time, the environment variable To take effect, you need to execute

source /etc/profile

echo to check whether it takes effect

echo $JAVA_HOME
/usr/java/jdk1.8.0_211

After 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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn