[Linux deployment JDK detailed explanation, personal test]

1. Download JDK

Official website address: official website address

2. Create a directory and install

1. Enter the data directory and create a java folder

## 进入data目录
cd /data
## 创建java目录
madir java
## 进入java目录
cd java/

Insert image description here

2. Upload the "jdk-8u381-linux-x64.tar.gz" file to the current directory (/data/java)

3. Unzip the file

tar -zxvf jdk-8u381-linux-x64.tar.gz

Insert image description here

4. Configure Java environment variables (enter the "/etc/profile.d" directory and upload jdk.sh to the current directory (/etc/profile.d))

## 进入文件
cd /etc/profile.d

jdk.sh file: can also be downloaded directly from the resource bar

export JAVA_HOME=/data/java/jdk1.8.0_381
export JRE_HOME=/data/java/jdk1.8.0_381/jre
export CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin

5. Make environment variables take effect immediately

## 刷新环境变量文件
source /etc/profile

6. Final verification of Java

java -version

Insert image description here

Guess you like

Origin blog.csdn.net/m0_49762804/article/details/132362282