James Gosling created Java at Sun Microsystems, where it was first introduced as a key element of the Java platform in May 1995. Sun first made available under proprietary licenses the original and reference implementation Java compilers, virtual machines, and class libraries.
Sun had relicensed the majority of its Java technologies under the GPL-2.0-only license as of May 2007 in order to comply with the requirements of the Java Community Process. Although Oracle provides its own HotSpot Java Virtual Machine, the OpenJDK JVM, which is a free open-source program and is the default JVM for practically all Linux distributions, is the official reference implementation.
To run Java programs, the Java Runtime Environment (JRE) is necessary. Although there are numerous JRE packages available today from numerous initiatives and businesses, OpenJDK and Oracle HotSpot are the two most often used on Ubuntu.
The majority of applications shouldn’t function differently when using one package over the other, but some people prefer OpenJDK over Oracle HotSpot because it doesn’t contain closed-source components, has a much clearer licensing and support policy, is maintained as a part of the Ubuntu archive, and is simpler to install and upgrade.
Every six months, a new version of Java is published, making many versions accessible for use. Although Java 8 is still extensively used, Java 11 is the current Long Term Support (LTS) version. Additionally, Java’s non-LTS versions are seeing some popularity as well as a continual stream of innovation.
Installing the Default Java JRE/JDK
To install the default JDK for Java which ships with Ubuntu, start by refreshing the APT cache with the following command
sudo apt update
Run the following command to install the JDK
sudo apt install default-jdk
This should install Java in your Ubuntu system, run the following command to confirm it.
Java is successfully installed on your system. Next, you would like to install Gradle to manage the dependencies of your Java applications.
Here is a tutorial to help you with this: How To Install Gradle On Ubuntu Linux in 2 Minutes