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.
To install any package in Ubuntu through apt command is very simple.
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.
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.
sudo apt install openjdk-13-jdk openjdk-13-jre
sudo apt install openjdk-11-jdk openjdk-11-jre
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