JDK installation under CentOS 7
1. Import the installation package
Download the linux version jdk installation package in Windows and
upload it to CentOS (directly drag the compressed file into MobaXterm)
Second, unzip the file
First
enter the compressed file in the same directory as the cd file path tar -zxvf installation package name, decompress the file
and use the ll command to check it out
Three, configure JDK environment variables
vi /etc/profile command to open the configuration file
Configuration of environment variables
export JAVA_HOME=/root/software/jdk1.8.0_221
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
[Shift + G]: Quickly locate to the end of the article, then press [i], enter the insert mode, insert the above code
[Note: Everyone’s address in JAVA_HOME is different, look at the jdk installation path for yourself]
After inserting, press [Esc], enter [wq], save and exit.
After exiting, execute the
source /etc/profile command.
Enter the java -version and javac commands to see if it is successful