Linux – How to find which version of Java in Java installed folder

javalinuxversion

A version of java is installed on my Linux machine. When i try this:

root@test$: javac -version

It given the result as:

javac jdk1.7.0_80.

Now my problem is i don't know where that(1.7.0_80) java folder is. I have a folder named "java-7-oracle" in usr/lib/jvm. I am suspecting that it would be the folder for the installed version of java.

Now I have a java folder and I want to know which version of java it is?

How??

Best Answer

I think you can track all this by checking to where your java binaries linked to.

       #which javac
          /usr/bin/javac   
       #ls -ln /usr/bin/java
           lrwxrwxrwx. 1 0 0 22 Nov 27 04:54 /usr/bin/java -> /etc/alternatives/java
       #ls -ln /usr/bin/javac
            lrwxrwxrwx. 1 0 0 23 Nov 27 04:54 /usr/bin/javac -> /etc/alternatives/javac
       # ls -ln /usr/bin/javadoc
            lrwxrwxrwx. 1 0 0 25 Nov 27 04:54 /usr/bin/javadoc -> /etc/alternatives/javadoc

and finally:

#ls -ld /etc/alternatives/java
lrwxrwxrwx. 1 root root 46 Nov 27 04:54 /etc/alternatives/java -> /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java

therefore , my java installation is:

   /usr/lib/jvm/jre-1.7.0-openjdk.x86_64

I suppose you can track any binary like this.

Related Question