google cloud platform

How to find Java JDK Path – OpenJDK ?

This tutorial guides you on how to find Java JDK path of OpenJDK that is installed in your Linux machine.

How to find Java JDK Path – OpenJDK

It is really simple to find the Java JDK path – OpenJDK path installed in your ubuntu machine. Nowadays the VM instances by default have JDK installed on it. For example. Google Compute Engine instances by default have OpenJDK installed.

Therefore, it may be necessary for you to check whether OpenJDK is installed or not. Also which version of Java is installed on your Ubuntu VM instance.

To find Java OpenJDK path in your Ubuntu machine, you need to run the following command from the command line or terminal.

$ sudo update-alternatives --list java

From the above output, it is evident that the OpenJDK 11 is installed on your machine. And the JDK path is “/usr/lib/jvm/java-11-openjdk-amd64

To set JAVA_HOME with your OpenJDK path you need to execute the following export command from terminal. Therefore, you can use java environment to run Java based applications.

$ export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64

If you wanted to install OpenJDK on your ubuntu machine, then follow this tutorial: How to install OpenJDK 11 in Ubuntu Machine.

Finally, you can check Java Version by running the following command.

$ java -version
openjdk version "" 2020-11-04
OpenJDK Runtime Environment (build
OpenJDK 64-Bit Server VM (build, mixed mode, sharing)

That’s it. You have learnt how to find Java JDK path – OpenJDK installed on your ubuntu machine.

Hope it helped 🙂


Inline Feedbacks
View all comments