Install OpenJDK JRE / JDK in Ubuntu 19.04

In this article, we would discuss how to install both OpenJDK Java runtime (JRE) & Development Kit (JDK) in Ubuntu 19.04 release. Here, JRE is an acronym for Java runtime and JDK is an acronym for Java Development Kit.

For those who just want to run Java applications / programs can install Java runtime. On the other hand, to develop Java applications you need to install Java Development Kit. In case, if you plan on to install JDK, then you wouldn’t have to install JRE separately. JRE package itself comes bundled with JDK. Both the packages are available in standard Ubuntu repository. Also, you need to first check whether you have JDK/JRE already installed. Therefore, run the following in terminal –

java -version

If Java is not installed, then it will return with the following output. We have been using Ubuntu 19.04, if you are on a different release of Ubuntu then you may see different versions in the output.

Command 'java' not found, but can be installed with:

sudo apt install default-jre                         # version 2:1.11-71, or
sudo apt install openjdk-11-jre-headless             # version 11.0.3+7-1ubuntu2~19.04.1
sudo apt install openjdk-8-jre-headless              # version 8u212-b03-0ubuntu1.19.04.2
sudo apt install openjdk-12-jre-headless             # version 12.0.1+12-1
sudo apt install openjdk-13-jre-headless             # version 13~13-0ubunt1

The following operations would require superuser privileges. In case, if you don’t one then contact your system administrator for assistance.

Install OpenJDK Java Runtime Environment (JRE)

Firstly, we would install Java Runtime Environment (JRE) to run Java written applications / programs. To do so, run the following in the terminal –

sudo apt install openjdk-11-jre

Why did we choose to install openjdk-11-jre not other packages like openjdk-12-jre? The answer to the question is pretty easy, openjdk-11-jre is currently the package supported by Ubuntu distribution. If you intend to install other package versions then you may opt one. It may take few minutes to install the packages depending on your speed of your network connection.

Once, done again run the following command in the terminal –

java -version

This time around, you would get the output –

openjdk version "11.0.4" 2019-07-16
OpenJDK Runtime Environment (build 11.0.4+11-post-Ubuntu-1ubuntu219.04)
OpenJDK 64-Bit Server VM (build 11.0.4+11-post-Ubuntu-1ubuntu219.04, mixed mode, sharing)

This installs Java runtime environment on your system. Next, we would discuss installation steps for Java Development Kit (JDK).

Install OpenJDK Development Kit (JDK)

In case you would like to develop Java applications then, you would have to install OpenJDK Development Kit (JDK). To do so, run the following command in terminal –

sudo apt install openjdk-11-jdk

As discussed earlier, this will also install openjdk-11-jre. Upon successful installation, run the following in the terminal –

java -version

It will return with the following output.

openjdk version "11.0.4" 2019-07-16
OpenJDK Runtime Environment (build 11.0.4+11-post-Ubuntu-1ubuntu219.04)
OpenJDK 64-Bit Server VM (build 11.0.4+11-post-Ubuntu-1ubuntu219.04, mixed mode, sharing)

In conclusion, both JDK as well as JRE could be installed depending on our requirements. JDK for development purposes and JRE for simply running Java applications.

Similar Posts