linux commands

How to install OpenJDK 11 in Ubuntu Machine ?

This tutorial guides you on how to install JDK 11 in ubuntu machine i.e., install OpenJDK 11 from Oracle in Ubuntu from the command line.

Install OpenJDK 11 in Ubuntu – Package

To install OpenJDK via packages in Ubuntu machine, you need to execute the following command from command line.

$ sudo apt-get install openjdk-11-jdk

After installation, you can check the installation and Java version that is actually installed using the following command.

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

Installing OpenJDK 11 in Ubuntu – Manually

To install OpenJDK in Ubuntu manually, you need to download the tar ball and extract it somewhere as shown below.

First, you need to download the required OpenJDK version from the OpenJDK Archive

For example, you can download locally using wget command as shown below.

$ wget
--2021-01-18 14:32:26--
Resolving (
Connecting to (||:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 187599951 (179M) [application/x-gzip]
Saving to: ‘openjdk-11.0.1_linux-x64_bin.tar.gz’

openjdk-11.0.1_linux-x64_bin.tar.gz     100%[=============================================================================>] 178.91M  5.50MB/s    in 31s 

2021-01-18 14:32:58 (5.72 MB/s) - ‘openjdk-11.0.1_linux-x64_bin.tar.gz’ saved [187599951/187599951]

[email protected]:~ (poised-shift-300712)$ ls
openjdk-11.0.1_linux-x64_bin.tar.gz  testdir

Then you need to extract the downloaded OpenJDK tar.gz file to Java’s default location as shown below.

$ sudo tar xfvz openjdk-11.0.1_linux-x64_bin.tar.gz --directory /usr/lib/jvm

Once the extraction is done, you can remove the tar.gz file if you would like by running the following command.

$ rm -f openjdk-11.0.1_linux-x64_bin.tar.gz

That’s it. you have learnt how to install OpenJDK 11 in ubuntu machine using packages and by manually.

Hope it helped 🙂


Inline Feedbacks
View all comments