×


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

Oracle Java 16 was released on 16 March 2021 and will provide 17 enhancements that will go a long way in boosting developer productivity. The Java 16 release is a result of many weeks of extensive collaboration between the worldwide Java developer community and Oracle engineers to deliver a robust development platform.

Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to perform related Java queries on Linux systems.

In this context, we shall look into how to install Oracle Java 16 on Ubuntu 20.04.


What is new about Java 16?

  • New language improvements.
  • New tools to boost developer productivity.
  • Better memory management to enhance performance.
  • Improved networking to boost developer productivity & flexibility.
  • New ports to provide additional support for Java on multiple platforms.

 

How to Install Oracle Java 16 On Ubuntu Linux system ?

To install Oracle Java 16 on Ubuntu, we need to follow the below outlined steps.


1. Perform system update

Before installing Java, you need to Update the system and install dependencies. This can be implemented by updating the package index with the below command:

$ sudo apt update

Next, install the dependencies required during the installation:

$ sudo apt install software-properties-common


2. Add Oracle Java PPA repository

The Linux Uprising PPA https://launchpad.net/~linuxuprising/+archive/ubuntu/java provides an automated script and packages that downloads and installs Oracle Java.These packages are are part of the WebUpd8 Oracle Java PPA packages. Note, however, that due to licensing, Java Binaries are not included in this PPA.

To add the Linux Uprising PPA, run the command shown. When prompted hit ENTER:

$ sudo add-apt-repository ppa:linuxuprising/java

Next, Append the Linux Uprising PPA to the sources list file. But first, switch to root user:

$ sudo su

Then add the PPA with the below command:

$ echo "deb http://ppa.launchpad.net/linuxuprising/java/ubuntu focal main" | tee /etc/apt/sources.list.d/linuxuprising-java.list

Next, import the GPG signing key:

$ apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 73C3DB2A

Thereafter, Update the package lists to synchronize with the Linux Uprising PPA:

$ sudo apt update


3. Install Oracle Java 16 on Ubuntu

Finally, install Oracle Java 16 using the below command:

$ sudo apt install oracle-java16-installer

Next, Read the License terms and press TAB to highlight the 'Ok' button and press ENTER.

Next, select 'Yes' to accept the license agreement.

The installation of Oracle Java will continue and finally, come to a close. To verify the version of Java installed, run the command:

$ java -version

OR

$ javac -version


[Need assistance in Installing Java Software on Debian Linux system ? We can help you. ]


Conclusion

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.