How To Install Java On Linux Ubuntu 20.04

Install Java 14 on Ubuntu Linux Systems. Here is how to download and install Oracle JDK 14 on Ubuntu Linux. This tutorial explains how to install Oracle Java 14 on Ubuntu 20.04, Ubuntu 19.10, Ubuntu 19.04, Ubuntu 18.10, Ubuntu 18.04 and other Ubuntu Derivatives.

Oracle Announces Java 14

Oracle JDK 14 represents more
than two years of on-time six-month feature releases, bringing
innovation and predictability to developers

Oracle JDK 14 adds new features to improve developer
productivity, including Java language support for switch expressions,
new APIs for continuous monitoring of JDK Flight Recorder data, and
extended availability of the low-latency Z Garbage Collector to macOS
and Windows

This new release includes three preview features:
Pattern Matching for instanceof (JEP 305), Records (JEP 359) and Text
Blocks (JEP 368)

The release statement explains how the Oracle Java 14 (Oracle JDK 14) brings new enhancements to enterprises and the developer community with a new feature release every six months. The latest Java Development Kit (JDK) delivers new features, including two new highly anticipated preview features – Pattern Matching for instance of (JEP 305) and Records (JEP 359), as well as a second preview of Text Blocks (JEP 368).

Additionally, the latest Java release adds Java language support for switch expressions, exposes new APIs for continuous monitoring of JDK Flight Recorder data, extends the availability of the low-latency Z Garbage Collector to macOS and Windows, and adds, in incubator modules, the packaging of self-contained Java applications and a new Foreign memory access API for safe, efficient access to memory outside of the Java heap.

More info: https://www.oracle.com/corporate/pressrelease/oracle-announces-java14-031720.html

Install Java 14 on Ubuntu Linux

Install Java 14 on Ubuntu Linux Systems. Here is how to download and install Oracle JDK 14 on Ubuntu Linux. This tutorial explains how to install Oracle Java 14 on Ubuntu 19.10, Ubuntu 19.04, Ubuntu 18.10, Ubuntu 18.04 and other Ubuntu Derivatives.

Run the following commands to install Oracle Java 14 on Ubuntu 19.10, Ubuntu 19.04, Ubuntu 18.10, Ubuntu 18.04 and other Ubuntu Derivatives:

sudo add-apt-repository ppa:linuxuprising/java
sudo apt update
sudo apt install oracle-java14-installer
sudo apt install oracle-java14-set-default

The last line of code will make Java 14 the default.

Install OpenJDK 11

Run the following commands to install the OpenJDK 11 JDK package:

sudo apt update
sudo apt install openjdk-11-jdk

Once the installation is complete, verify it by the following command:

java -version

Install OpenJDK 8

Run the following commands to install the OpenJDK 8 JDK package:

sudo apt update
sudo apt install openjdk-8-jdk

Once the installation is complete, verify it by the following command:

java -version

Setting the Default Version

If you have multiple Java versions installed on your Ubuntu Linux System, you can set the default version. Before doing this, check which version is set as the default one by using the following command:

java -version

Now if you wish to change the default version of Java, use the update-alternatives command to do so:

sudo update-alternatives --config java

How To Install Java On Linux Ubuntu 20.04 originally posted on Source Digit – Linux, Ubuntu Tutorials & News, Technology, Gadgets & Gizmos.