amitection amitection - 1 month ago 10
Linux Question

Unable to locate JDK in Linux VM

I am trying to locate the JDK to setup jstatd but I am unable to locate it.

When I type

java -version
I get the following response

java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)


Then I tried locating it using the following 2 commands:


  1. which java



Response:
/usr/bin/java


I tried to
cd
it but I get
-bash: cd: /usr/bin/java: Not a directory



  1. Then I tried this
    whereis java


    Response:
    java: /usr/bin/java /usr/bin/X11/java /usr/share/java /usr/share/man/man1/java.1.gz



I again tried to cd it. But still not a directory.
Where could it be installed?

Answer

Usually jdk's and jre's are located under /usr/lib/java or /usr/lib/jvm. To be sure, do an ls -la $(which java), it should be a symlink pointing to the real binary (You could have to repeat this operation, usually if there are alternatives this link could point to another link).

Comments