How to download jdk in centos

王林
Release: 2020-05-18 10:07:14
Original
2649 people have browsed it

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
Copy after login

How to download jdk in centos## List packages matching installed java:

yum list installed | grep java
Copy after login

Uninstall jdk:

yum -y remove java-1.7.0-openjdk*
yum -y remove java-1.8.0-openjdk*
Copy after login

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
Copy after login

to decompress the package:

tar -zxvf jdk-8u211-linux-x64.tar.gz
Copy after login

4. Configure environment variables

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

 vim /etc/profile
Copy after login

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
Copy after login

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
Copy after login

echo to check whether it takes effect

echo $JAVA_HOME
/usr/java/jdk1.8.0_211
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!