Oracle Java 17 Released as New LTS, Here’s How to Install it in Ubuntu

Oracle announced the release of Java 17 as the new Long-Term Support (LTS) release.

Java 17 LTS comes with thousands of performance, stability, and security updates, as well as 14 JEPs (JDK Enhancement Proposals). And Oracle will provide 8-year support for the release with security, performance, and bug-fix updates until 2029.

According to the release note, the next LTS will be Java 21 planned for September 2023, which changes the LTS release circle for every three years to two years.

What’s New in Oracle Java 17:

JDK 17 includes new language enhancements, updates to the libraries, support for new Apple computers, removals and deprecations of legacy features, and work to ensure Java code written today will continue working without change in future JDK versions. It also offers a language feature preview and incubating APIs to gather feedback from the Java community.

Updates in the release include:

  • Sealed classes and interfaces restrict which other classes or interfaces may extend or implement them.
  • Restore Always-Strict Floating-Point Semantics
  • New interface types and implementations for Pseudo-Random Number Generators (PRNGs), including jumpable PRNGs and an additional class of splittable PRNG algorithms (LXM).
  • Implement a Java 2D pipeline for macOS using the Apple Metal API.
  • New Arm 64-based Apple Silicon computers support.
  • Deprecate the Applet API for removal
  • Remove the Remote Method Invocation (RMI) Activation mechanism
  • Remove the Experimental AOT and JIT Compiler
  • Deprecate the Security Manager for removal
  • Strongly encapsulate all internal elements of the JDK, except for critical internal APIs such as sun.misc.Unsafe.
  • Pattern matching for switch expressions and statements, along with extensions to the language of patterns.
  • Improves Foreign Function and Memory API and Vector API.

How to Install Oracle Java 17 in Ubuntu:

Thanks to the “Linux Uprising” team ppa, an installer script has been created to automatically downloads and installs Oracle JDK 17 package, and sets Java 17 as the default Java version (setting JAVA_HOME, etc.) on 64-bit PC and arm64 devices, e.g., Rasperry Pi and Microsoft HoloLens 2.

1.) Firstly, open terminal either from system start menu or by pressing Ctrl+Alt+T on keyboard. When it opens, run command to add the PPA:

sudo add-apt-repository ppa:linuxuprising/java

Type user password when it asks (no asterisk feedback) and hit Enter to continue.

2.) Refresh system package cache. The PPA provides packages for Ubuntu 18.04, Ubuntu 20.04, Ubuntu 21.04, Ubuntu 21.10, as well as two old Ubuntu LTS (14.04 and 16.04). And old Ubuntu releases need to manually update system cache by running the command below in terminal:

sudo apt-get update

3.) Finally install the script package via command:

sudo apt-get install oracle-java17-installer

Once the script starts, it brings you to the screen for the license. Press Tab key on keyboard to select OK and hit Enter.

Then answer “Yes” via arrow keys and hit Enter to start downloading Java 17 package from oracle website.

Terminal will indicate the downloading and installing process for you. When everything’s done successfully, use java --version or javac --version command to verify the installation.

That’s all. Enjoy!