The Java Runtime Environment (JRE) and Java Development Kit (JDK) are OpenJDK packages. The JRE includes Java virtual machine (JVM), classes, and binary files that are necessary to run the Java program. On the other hand, JDK contains JRE and other debugging and development tools. Download and install JDK if you are focused on creating Java applications. The new versions of Java are released gradually. At the time of preparing this post, JDK 11 is the latest long-term support (LTS) release, whereas 13, 14, and 15 are the feature releases of Java. The JDK 12 has been superseded because it does not include the most up to date security vulnerability fixes and is no longer recommended for use in production.
For instance, if you are not sure which java package you should install, then it is suggestted to install JDK 11.
We are using Ubuntu 20.04 for installing the latest java versions.
Install OpenJDK 11
The OpenJDK 11 is included in the Ubuntu 20.04 base repository. Update the package listing before installing OpenJDK 11 using:
Now, install OpenJDK with the command:
The OpenJDK 11 LTS will be installed successfully.
Install OpenJDK 13
The OpenJDK 13 is available from the Ubuntu 20.04 default repository and can be installed using the command:
Install OpenJDK 14
The OpenJDK 14 is available from the Ubuntu 20.04 default repository and can be installed using the command:
Install OpenJDK 15
Released on 15 September 2020, the OpenJDK 15 is the latest feature release of JDK. But it is not the part of Ubuntu 20.04 base repository.
To install OpenJDK 15, download its Debian package from the Oracle official website (https://www.oracle.com/java/technologies/javase-jdk15-downloads.html).
The downloaded Debian Package will be saved in the Downloads directory. Navigate to the Downloads directory:
Next, install OpenJDK 15 through the Debian package using the apt command:
Verify the OpenJDK installed version
Once you have installed your desired OpenJDK version on Ubuntu 20.04, you can then verify or check the installed version using:
To run and use Java in any environment, we need to install JDK. The OpenJDK 11 is the LTS release, whereas Java 13, 14, and 15 are the feature releases. This post describes how to install OpenJDK 11, 13, 14, and 15 on Linux, especially Ubuntu 20.04.