This article is a quick guide for Ubuntu Linux users installing Java 11, the current long-term support (LTS) Java version. I'll briefly make the case for migrating your code base to Java 11, then guide you through the steps to install Oracle JDK 11 using the Ubuntu command line.

Note that this is a quick guide for Ubuntu users installing Java 11. I won't dive too deep into Java 11 features or migration issues, which are amply covered elsewhere.

Released in March 2014, Java 8 promised a more modern approach to Java development. This trend continued in 2017, when Oracle announced a faster development cadence, throwing out the all-or-nothing approach that had allowed Java SE to stagnate between previous releases.

Fewer Java releases are slated for long-term support, so it’s important to pay attention. The much-loved Java 8 is already in the dustbin, as far as Oracle is concerned, and so are Java 9 and Java 10. You can still use these versions, but they are not being actively updated or supported.

[ Also see: What’s new in Ubuntu Linux 18.10 ‘Cosmic Cuttlefish’. ]

For developers looking for the ideal mix of current features and long-term support, JDK 11 is a good bet. Oracle has committed to Java SE 11 until 2026. The combination of features, updates, and support makes this version ideal for new development, as well as for migrating your Java 8 code-base to a newer platform.

Note that this tip assumes you have already installed Ubuntu 18.04 or 18.10.

The first thing you need to do is update the system, using the following command:

Next, make sure the checksum of the binary matches:

Now create a folder and copy the Oracle JDK 11 from downloads:

Tip: You may also want to create a folder in /var/cache/oracle-jdk11-installer-local/.

Next, you will add PPA (Personal Package Archive) to Ubuntu apt:

Doing this ensures the package cache will be automatically refreshed.

Now install Oracle JDK 11:

Lastly, always check whether the installation has been successful:

If your install was succesful, you'll see something like this:

Once again, you start by adding PPA:

Next, you'll install the script that initiates downloading and installing Java 11 on Ubuntu:

Accept the license by pressing Tab to highlight OK, then hit Enter.

Tip: You've already added PPA, so you can skip sudo apt-get update command.

If you have installed multiple versions and want to remove earlier ones, start by entering remove oracle-java11-set-default package, then set Java 11 as the new default: sudo apt-get install oracle-java11-set-default-local.

Use the java --version to check the current version.

You should see something like this:

Figure 1. A version check confirms JDK 11 is successfully installed on Ubuntu Linux

If for any reason you wish to uninstall Oracle JDK 11, simply run the following command:

As as an Ubuntu user, recall that you may go to Software & Updates -> Other Software to remove the PPA repository.

This story, "Installing Oracle Java SE 11 on Ubuntu 18.04" was originally published by JavaWorld.

ITNews