Develop a habit, like first and then watch!!!
table of Contents
1 Introduction
Because I am using Alibaba Cloud server here, I have installed jdk in it when I first bought it, but because I did not install it, I don’t know where it is installed. I checked it online and said something If it's not good to hear, many blogs are very nonsense, and echo $JAVA_HOME
they will be approved by people . At first I used this method myself, but after thinking about it, I haven't set environment variables. How could this command take effect? Well, so many blogs are completely nonsense, and have not considered the feelings of most people at all. Finally found the right solution, here is a record.
2. Steps
2.1 Check whether jdk is installed
First of all, we must make sure that there is jdk on our system, otherwise everything is useless
java -version
If you query the following interface, it means that there is indeed jdk
2.2 Find the location of the java command
which java
So we can see the corresponding path name
2.3 Find and list the original file or directory pointed to by the link
ls -l /usr/bin/java
2.4 Find the directory
ls -l /etc/alternatives/java
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.232.b09-0.el7_7.x86_64 is the jdk installation directory
The code word is not easy, if you think it is helpful to you, you can follow my official account, the newcomer up needs your support!!!