Sunday, May 3, 2015

How To Find Java Installation Location In Linux

First run below command:
  • $ whereis -b java
The above command will search for Java binaries. And it will return some results like below:
java: /usr/bin/java /etc/java /usr/lib/java /usr/local/java

Next step would be to check whether the location returned is symbolic link or not. That can be easily found. Run below command:
  • $ ls -l /usr/bin/java
It returned something like below in my case:
lrwxrwxrwx. 1 root root 21 Dec 20  2013 /usr/bin/java -> /etc/alternatives/java

So the location was actually a symbolic link. Next run the following command using the above location:
  • $ ls -l /etc/alternatives/java
In my machine it returned result similar to below:
lrwxrwxrwx. 1 root root 46 Dec 20  2013 /etc/alternatives/java -> /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java

That's my actual Java location. So basically you have go deeper through the symbolic links and you will find your actual JDK location.

No comments:

Post a Comment