Find Java JRE location on Ubuntu Linux

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.

joris@howlingmad: ~_011

 

So, let’s find out a but more about /usr/bin/java:

ls -l /usr/bin |grep java

joris@howlingmad: ~_012

 

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:

joris@howlingmad: ~_013

 

As you can see in the screenshit, our java executable within the JRE location is:

/usr/lib/jvm/java-7-oracle/jre/bin/java

Which means the JRE location is:

/usr/lib/jvm/java-7-oracle/jre

 

 

 

Advertisements