install java OpenJdk on Ubuntu

Java is a class based, object oriented programming language. It is cross platform and widely use in developing applications. The Java was first developed in Sun Microsystem (Now acquired by Oracle).

In this post, to install Java we will use the OpenJDK package. OpenJDK is a free and open source product implements Java SE which is currently manage by Oracle Developers. It was actually initiated by Sun Microsystem.

Java comes with three editions, these are –
1. Java SE (Standard Edition)
2. Java EE (Enterprise Edition)
3. Java ME (Micro Edition)

Difference between JDK and JRE

JDK (Java Development Kit) is used for development purpose, it has libraries, development tools ,debugging tools and private JVM.
JRE (Java Runtime Environment) is require to run Java programmes only.

Install Java (OpenJDK) on Ubuntu

We have inline the steps which are generic in all Ubuntu version. Only thing you have to do is just read this post carefully and apply.

Search available OpenJDK packages in apt repo

First we will search in our Ubuntu system how many OpenJDK version is available in Ubuntu repositories.

sudo apt -y update
sudo apt search openjdk*

After running above command, it will show N number of package list. Just read the output and find the desirable package which you want to install.

Watch this video, it will show how to search OpenJDK packages in Ubuntu.

Install OpenJDK

To install any package in Ubuntu through apt command is very simple.

Syntax:

sudo apt install <\package-name\>

Similarly to install OpenJDK we will use the apt command as described in above syntax. You can see in video which we have posted in this article, we can find the OpenJDK version list by searching through apt search package-name command.

Install OpenJDK-14
At the time of writing this post, OpenJDK-14 was latest stable version.

sudo apt install openjdk-14-jdk openjdk-14-jre

Similarly you can install other OpenJDK version in same manner.

Install OpenJDK-13

sudo apt install openjdk-13-jdk openjdk-13-jre

Install OpenJDK-11

sudo apt install openjdk-11-jdk openjdk-11-jre

Install OpenJDK-8

sudo apt install openjdk-8-jdk openjdk-8-jre

Set the default Java

When you have multiple Java packages in system, you can select the desired Java version by using following command.

sudo update-alternatives --config java

update-alternatives

Read Some More Articles

One Comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.