Find out where the java entity is on Linux (CentOS this time)

Conclusion

Use which and ls to track links.

# java -version
java version "1.8.0_72"
Java(TM) SE Runtime Environment (build 1.8.0_72-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.72-b15, mixed mode)
# which java
/usr/bin/java
# ls -al /usr/bin/java
lrwxrwxrwx 1 root root 22 January 24 13:51 2016 /usr/bin/java -> /etc/alternatives/java
# ls -al /etc/alternatives/java
lrwxrwxrwx 1 root root 34 January 24 13:51 2016 /etc/alternatives/java -> /usr/java/jdk1.8.0_72/jre/bin/java

background

There was a case where it was suspected that the java of the inherited server was old, and when I checked the location of java, it was as follows.

# ls -al /usr/java/
20 in total
drwxr-xr-x.4 root root 4096 August 20 09:43 2018 .
drwxr-xr-x.14 root root 4096 December 23 15:15 2015 ..
drwxr-xr-x 9 root root 4096 January 24 14:00 2016 apache-tomcat-8.0.30
lrwxrwxrwx 1 root root 16 January 24 13:51 2016 default -> /usr/java/latest
drwxr-xr-x 9 root root 4096 January 24 13:51 2016 jdk1.8.0_72
lrwxrwxrwx 1 root root 21 January 24 13:51 2016 latest -> /usr/java/jdk1.8.0_72
-rw-r--r--1 root root 3405 January 24 14:27 2016 velocity.log

I wanted to unpack the tar, but I didn't know if I was directly referencing jdk1.8.0_72 or using latest or default, so I checked.

Digression

After all, I installed rpm.

# ls -al /usr/java/
24 in total
drwxr-xr-x.5 root root 4096 August 20 09:56 2018 .
drwxr-xr-x.14 root root 4096 July 7 17:12 2018 ..
drwxr-xr-x 9 root root 4096 January 24 14:00 2016 apache-tomcat-8.0.30
lrwxrwxrwx 1 root root 16 January 24 13:51 2016 default -> /usr/java/latest
drwxr-xr-x 8 root root 4096 August 20 09:55 2018 jdk1.8.0_181-amd64
drwxr-xr-x 9 root root 4096 January 24 13:51 2016 jdk1.8.0_72
lrwxrwxrwx 1 root root 28 august 20 09:56 2018 latest -> /usr/java/jdk1.8.0_181-amd64
-rw-r--r--1 root root 3405 January 24 14:27 2016 velocity.log
# which java
/usr/bin/java
# ls -al /usr/bin/java
lrwxrwxrwx 1 root root 22 August 20 09:56 2018 /usr/bin/java -> /etc/alternatives/java
# ls -al /etc/alternatives/java
lrwxrwxrwx 1 root root 41 August 20 09:56 2018 /etc/alternatives/java -> /usr/java/jdk1.8.0_181-amd64/jre/bin/java

Recommended Posts

Find out where the java entity is on Linux (CentOS this time)
On Linux, the time stamp of a file is a little past.
Find out the CentOS7 MAC address (HWADDR)
[Java] [Linux] Investigating how the implementation of Java child processes on Linux is realized
virtualenv For the time being, this is all!
Execute packet capture at the specified time on CentOS7
Procedure for manually installing Java (jdk1.8) on Linux (CentOS7)
Announcing the availability of Java 11 LTS on Amazon Linux 2
Find the most F-word commit on Linux (git and later)
Find out how many each character is in the string.
If you're learning Linux for the first time, do this!
What is the Linux kernel?
Install the JDK on Linux
Paste the link on linux
Build a Selenium environment on Amazon Linux 2 in the shortest time
[Linux] When the screen is cut off when installing CentOS in VirtualBox
[Profile] Identify where the program is taking a long time (google-perftool)
What to do if the inode is exhausted on EC2 Linux