Related to apt install java 16

Install Oracle Java 16 On Ubuntu 18.04 / 20.04 / 21.04 - A step by step Process ?

This article covers the right steps to successfully install Oracle Java 16 on Ubuntu 20.04. In fact, The Java JDK (Java Development Kit) is a software development environment used for developing Java Applications. The JDK is a collection of programming tools, notably JRE (Java Runtime Environment), Java (Loader for Java Application), Javac (Compiler), Jar (Archiver), etc. You can now proceed and start developing your Java applications with the enhanced features provided with the latest Java 16 version.

To Check the java version Installed on the system, sumply issue the following command:

$ java -version

How to Set Default Java Version on Ubuntu Linux system ?

1. You can Use the alternatives command to set the default java version.

Simply run the below command on the terminal:

$ sudo update-alternatives --config java

Then you will be given an output such as this to Select Java:

There are different choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                         Priority   Status
  0            /usr/lib/jvm/java-11-openjdk-amd64/bin/java   1111      auto mode
  1            /usr/lib/jvm/java-11-openjdk-amd64/bin/java   1111      manual mode
  2            /usr/lib/jvm/jdk-11.0.12/bin/java             2         manual mode
  3            /usr/lib/jvm/jdk-16.0.2/bin/java              1         manual mode
* 4            /usr/lib/jvm/jdk1.8.0_301/bin/java            3         manual mode
Press  to keep the current choice[*], or type selection number: 1

2. Then, Enter the number below the selection column to set the default Java version and press Enter button to proceed.