Oracle Java 16 Released, How to Install it in Ubuntu 20.04, 18.04, 20.10

Last updated: September 15, 2021

Oracle Java 16 was announced as a short release with 6-month support. Here’s how to install it in Ubuntu 14.04, Ubuntu 16.04, Ubuntu 18.04, Ubuntu 20.04, Ubuntu 20.10 via PPA.

UPDATE: Oracle Java 17 has been released as the new LTS (Long Term Support Release). This tutorial also works for the new release!

New features in the release include:

  • Vector API (Incubator)
  • Enable C++14 Language Features
  • Migrate from Mercurial to Git
  • Migrate to GitHub
  • ZGC: Concurrent Thread-Stack Processing
  • Unix-Domain Socket Channels
  • Alpine Linux Port
  • Elastic Metaspace
  • Windows/AArch64 Port
  • Foreign Linker API (Incubator)
  • Warnings for Value-Based Classes
  • Packaging Tool
  • Foreign-Memory Access API (Third Incubator)
  • Pattern Matching for instanceof
  • Records
  • Strongly Encapsulate JDK Internals by Default
  • Sealed Classes (Second Preview)

The “Linux Uprising” team ppa has made the installer script, which automatically downloads and installs Oracle JDK 16 package, and sets Java 16 as the default Java version (setting JAVA_HOME, etc.) on 64-bit Ubuntu based system.

1.) Open terminal and run command to add the PPA:

sudo add-apt-repository ppa:linuxuprising/java

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

2.) After adding PPA, refresh system package cache and install the script:

sudo apt update

sudo apt install oracle-java16-installer

For Java JDK 17, replace the package name so the command will be:

udo apt install oracle-java17-installer

Once the package is installed, you have to accept the license (press Tab to highlight) before starting the download process.

And after installed Oracle Java 16, check via java --version command:

(Optional) To uninstall the PPA repository, run command in terminal:

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

And remove Oracle Java 16 if you want by running command:

sudo apt-get remove oracle-java16-installer

Twitter

I'm a freelance blogger who started using Ubuntu in 2007 and wishes to share my experiences and some useful tips with Ubuntu beginners and lovers. Please comment to let me know if the tutorial is outdated! And, notify me if you find any typo/grammar/language mistakes. English is not my native language. Contact me via [email protected] Buy me a coffee: https://ko-fi.com/ubuntuhandbook1 |

13 responses to Oracle Java 16 Released, How to Install it in Ubuntu 20.04, 18.04, 20.10

  1. Great article. Wasted so much time until i find your article. Keep it up

  2. I am not able to accept the license. When I go to the link, I don’t see the “Accept License Agreement” button ANYWHERE on the page.

    (This is the page I am sent to: https://www.oracle.com/downloads/licenses/javase-license1.html)

  3. THANK YOU. Holy shit ive wasted so much time trying to update my java on this damn ubuntu version. This made it mega quick and easy. Much love

  4. Thanks

  5. E: Package ‘oracle-java16-installer’ has no installation candidate

  6. Hey thanks a lot for this, it’s been tremendously helpful. I’m trying to use this in a CI environment so I can’t accept the oracle license manually. Is there any way to do it via the command line?

    • for me I just had to press tab and it would highlight the options ( and ) and then press enter to select them.

  7. Package ‘oracle-java16-installer’ has no installation candidate

  8. Unable to locate package oracle-java16-installer

    • Make sure the PPA repository is successfully added. Open “Software & Updates” utility and see in ‘Other Software’ tab. Also refresh the package cache via command:

      sudo apt update