Everybody knows that the java executable is located in /usr/bin/java , but what if you need the JDK / JRE location itself?
Just using “whereis” will not get you there, that will point you to the /usr/bin/java point.
So, let’s find out a but more about /usr/bin/java:
ls -l /usr/bin |grep java
Awesome, this will lead us somewhere, it’s a symlink to /etc/alternatives/java
So let’s do the same there:
ls -l /etc/alternatives/ |grep java
And we’ve hit the jackpot, among the lines here, there’s a bunch of lines pointing us to the JRE location:
As you can see in the screenshit, our java executable within the JRE location is:
Which means the JRE location is: