Centos7 configure JDK

CentOS7 comes with jdk1.8

View the current system jdk version: java -version

List the packages that match the installed java: yum list installed | grep java

Uninstall the installed jdk:

yum -y remove java-1.7.0-openjdk*

yum -y remove java-1.8.0-openjdk*

There are many ways to install the JDK, I will just decompress the JDK package manually

You can directly use XSHELL to connect to the virtual machine, enter the directory where you want to store the JDK, and then drag the tar package directly from the windows desktop, or use the command rz -e

Now I will talk about the pits I stepped on! ! !

When decompressing, use the tar command, and the following parameters must not be less, try not to use tar -xf, so that the decompression process will not be displayed, and the decompression error will not be reported, I just because the tar package is damaged, the decompression error causes the jdk to continue Bad match!

It is recommended to use tar -zxvf

Then configure environment variables:

vim /etc/profile Edit profile file and input: vim /etc/profile

Enter the following:

export JAVA_HOME=/home/sun/software/jdk1.8.0_221 --- The specific path is configured according to the path where you installed the JDK

export CLASSPATH=.:JAVA_HOME/jre/lib/rt.jar:JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

export PATH=PATH:JAVA_HOME/bin

Notes:

JAVA_HOME indicates the JDK installation path, which is the path selected during the installation. This path includes lib, bin, jre and other folders (tomcat, Eclipse need to rely on this variable).

CLASSPATH is the path of java loading class (class or lib), only the class is in the classpath, the java command can recognize it, set: .:JAVA_HOME/lib/dt.jar:JAVA_HOME/lib/tools.jar:$JRE_HOME/ lib. In the CLASSPATH variable value. Represents the current directory

PATH enables the system to recognize java commands in any path, set to: JAVA_HOME/bin:JRE_HOME/bin.

Special attention: there is no sign at the end of the environment variable value, and the different values are separated by: (in windows, use;).

Make the configuration file effective: source /etc/profile

Verify the installation: java -version

Recommended Posts

Centos7 configure JDK
CentOS install jdk
Configure Ocserv on CentOS 6
CentOS7 install JDK8, tomcat8
Centos7 configure IP address
Centos7 configure nodejs environment
Configure CentOS7 GPU environment
Centos 7 install JDK (Linux install jdk)
CentOS 8 (2)
CentOS 7 install JAVA environment (JDK 1.8)
Centos6.5 install and configure mongodb
Centos configure multiple virtual IP
Tencent Cloud Centos install jdk8
Configure swap space on CentOS7
Install Java JDK8 under CentOS6
CentOS 8 (1)
Centos compile JDK8 source code
5.1. CentOS@ install JDK1.8 graphic tutorial
Centos configure multiple virtual IP
Centos 7 install jdk and package service service
CentOS 7 configure Java language development environment
Install and configure keepalived under CentOS 5.9
Install JDK8 in rpm on CentOS7
Configure rsyslog log client on CentOS
CentOS 6/7 configure sendEmail to send mail
Minimal install JDK 1.8 tutorial in CentOS 7
CentOS 7 configure Ruby language development environment
CentOS 7 configure php language development environment
CentOS8 install jdk8 / java8 tutorial (recommended)
Linux CentOS 7 install JDK detailed steps
CentOS 8 - install and configure NFS service
Centos7 uninstall openJdk, and install JDK1.8
Configure python3 environment on centos7 and
CentOS Minimal install and configure TIPS
Install and configure FreeIPA in Centos7
CentOS 7 configure Python language development environment
Configure Nginx reverse proxy based on CentOS 7
Configure Nginx load balancing based on CentOS 7
Configure iSCSI network storage under CentOS 7.x
centos7 python3.7+vi
CentOS + Python3.6+
CentOS + Jenkins
CentOS7 configure static address, turn off firewall
Deploy Docker and configure Nginx in CentOS
Graphical tutorial for installing JDK1.8 under CentOS7.4
Install CentOS7 virtual machine, configure docker suite
1.5 Install Centos7
2019-07-09 CentOS7 installation
centos7_1708 installation
Centos 7.5 python3.6
Three ways to install JDK under CentOS
How to install offline JDK1.8 on centos7.0
Centos7 installation jdk8 correct posture practice notes
Installation and configuration of JDK in CentOS 7 system
Install JDK and configure environment variables on Ubuntu 16.04
VMware Fusion install CentOS7 and configure the network
How to install and configure Elasticsearch on CentOS 7
CentOS Discovery Road 2---Use rpm to install JDK
Configure centos container to support ssh in Docker
How to install and configure VNC on CentOS 8
Configure Nginx to start automatically based on CentOS 7