Linux server download and install JDK

Time:2019-11-8

My website: www.mengyingjie.com

Related to this article: Download and install Tomcat on Linux server

The first is the download address of jdk8u211: https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Linux server download and install JDK

1 check and uninstall openjdk

The first step is to check whether the system comes with openjdk and related installation packages, and if so, uninstall them first.
Check command:

java -version
rpm -qa | grep java

If you find that there is an installed openjdk and the installation package, first perform the uninstall in turn.
Uninstall command:

rpm -e --nodeps tzdata-java-2012c-1.el6.noarch
rpm -e --nodeps java-1.6.0-openjdk-1.6.0.0-1.45.1.11.1.el6.x86_64

2 unzip the installation

(how to upload and download files to the server)
After uploading the installation file to the Linux server, enter the directory to decompress and install:

tar -zxvf jdk-7u75-linux-x64.tar.gz 

After decompression, create a new Java directory and move the newly extracted JDK directory to the directory we created:

mkdir /wocloud
mv ./jdk1.8.0_211 /wocloud

3 configure environment variables

(those who are not familiar with VI operation can learn)
After installation, you need to configure the following environment variables and edit the / etc / profile file:

vi /etc/profile

Add the following configuration at the end of the file:

export JAVA_HOME=/wocloud/jdk1.8.0_211
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin

The screenshot is as follows:
Linux server download and install JDK

After editing, press ESC and input: WQ save to exit. The last step is to reload the / etc / profile file through the source command, so that the modified content is valid in the current shell window:

source /etc/profile

4 test

inputjava -versionCheck the JDK version information:

As shown in the figure below, the JDK version is displayed normally, and has been installed successfully so far.
Linux server download and install JDK

I have encountered such problems, but I still haven’t solved them after reading the article,
Comment or add QQ: 781378815

Recommended Today

Details of multi-path and large capacity hard disk mount under CentOS

I. application environment and requirementsBlade servers connect HP storage through fiber switches, forming a 2×2 link The storage capacity of the operating system for CentOS 6.4 64 bit mount is 2.5t Based on this application environment, two problems need to be solved: In order to ensure the stability and transmission performance of the link, multi-path […]