JDK installation under CentOS 7

JDK installation under CentOS 7

1. Import the installation package

Download the linux version jdk installation package in Windows and
Insert picture description here
upload it to CentOS (directly drag the compressed file into MobaXterm)
Insert picture description here

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
Insert picture description here
and use the ll command to check it out
Insert picture description here

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.
Insert picture description here
After exiting, execute the
source /etc/profile command.
Enter the java -version and javac commands to see if it is successful
Insert picture description here

Guess you like

Origin blog.csdn.net/qq_43288259/article/details/113861067