Check jdk version, path and configuration environment variables on linux system

Table of contents

1. Check the jdk version

2. View the jdk installation directory

3. Configure jdk environment variables

4. Enter i to enter editing mode, go to the last line, add some code, then save and exit.

5. Reload the configuration file


1. Check the jdk version

java -version

2. View the jdk installation directory

# find / -name jre

 

 Or use

java -verbose

 The last line shows the path

3. Configure jdk environment variables

Open file using command

vim /etc/profile

4. Enter i to enter editing mode, go to the last line, add some code, then save and exit.

export JAVA_HOME=/usr/local/java   ---> jdk安装目录
export PATH=$PATH:$JAVA_HOME/bin

5. Reload the configuration file

source /etc/profile

Guess you like

Origin blog.csdn.net/qi341500/article/details/129335220