How to install Oracle Java 17 LTS on Ubuntu, Debian, Linux Mint or Pop!_OS via the APT PPA repository

Oracle Java 17 LTS has been Released Recently, it is now possible to install from Linux Uprising Oracle Java PPA on Ubuntu , Debian and Linux distributions based on these, such as Pop!_OS, Linux Mint, Zorin OS, etc.

Java 17 is the latest long-term support (LTS) version, with it, license It has been changed, binaries can be used in production for free (for free) and redistributed for free (for free) until a full year after the next LTS version is released. In the past (from Oracle Java 11 to the present), Oracle Java uses a commercial license, allowing it to be downloaded and used for free, only for development and testing, but requires payment to be used in production.

If you prefer to build with an open source JDK, please check out the Use OpenJDK Or Zulu OpenJDK.

I want to point out that even if Oracle Java 17 can be redistributed, Launchpad PPA terms Due to its license, it seems that it is not allowed to be packaged into a PPA. Therefore, Linux Uprising Oracle Java PPA continues to use scripts that automatically download Oracle Java (binaries are not hosted in Launchpad PPA).

This Oracle Java 17 installer is based on the Web Upd8 Java package (so the copyright belongs to its original creator) with minor modifications. The software package will be automatically downloaded and installed (with some adjustments, such as better font rendering, adding application menu entries, etc.) and you can choose to set Oracle Java 17 as the default Java (run update alternatives, export JAVA_HOME environment variables, etc.) Your system.

Oracle does provide DEB packages for Oracle Java, but these packages just copy the Java binaries to /usr/lib/jvm , Does not do anything else, so it is exactly the same as copying the Java directory to that location by yourself.

Using this PPA, you can install Oracle Java 17 for x64 and aarch64 architectures.

You may also like: How to use SDKMAN to install/switch between multiple Java versions

How to install Oracle JDK 17 on Ubuntu, Debian, Linux Mint, Pop!_OS or Zorin Os using APT PPA repository

Add the Linux Uprising Oracle Java PPA repository and use the following commands to update the software sources on Ubuntu, Linux Mint, Pop!_OS, or Zorin Os:


sudo add-apt-repository ppa:linuxuprising/java

sudo apt update

Add the Linux Uprising Oracle Java PPA repository (and its keys) and use the following methods to update the software sources on Debian and other Debian-based (but not Ubuntu and Ubuntu-based) Linux distributions:


su -

echo "deb focal main" | tee /etc/apt/sources.list.d/linuxuprising-java.list

apt-key adv --keyserver hkp:// --recv-keys 73C3DB2A

apt-get update


Now, you can install Oracle JDK 17 on Debian/Ubuntu and Linux distributions based on these:

  • Install Oracle JDK 17 and set it as the default JDK version:
                        sudo apt install oracle-java17-installer --install-recommends

  • Install but do not set Oracle JDK 17 as the default JDK version:
                        sudo apt install oracle-java17-installer --no-install-recommends

You can control whether Oracle JDK 17 is the default JDK version (running update alternatives, exporting JAVA_HOME environment variables, etc.) or using oracle-java17-set-default pack. If this is installed, Oracle JDK 17 is set as the default; delete this package, so Oracle Java 17 is not set as the default (unless it is the only Java version on the system).

This package is set as the recommended package for the Oracle Java 17 installer, which is the reason for the installation oracle-java17-installer with --install-recommends Also install oracle-java17-set-default .

To check which Java version is set as the default version on the system, you can run java -version and / or javac -version . Sample output showing Oracle Java 17 set as the default value:

                        $ java -versionjava version "17" 2021-09-14 LTSJava(TM) SE Runtime Environment (build 17+35-LTS-2724)

Java HotSpot(TM) 64-Bit Server VM (build 17+35-LTS-2724, mixed mode, sharing)

$ javac -versionjavac 17

In some cases, the installer may not be able to download the Oracle Java 17 .tar.gz archive from Oracle. There are multiple possible problems: you are behind a router/firewall that prevents this, your Internet connection fails during the download process, etc.

To solve this problem, you can Download this file yourself Obtain it from Oracle by other means, such as going to a friend’s house, using a web browser with a proxy, etc., and then put the downloaded Oracle Java 17 .tar.gz file into it /var/cache/oracle-jdk17-installer (If this folder does not exist, please create it as root), then install oracle-java17-installer As mentioned above, the software package from Linux Uprising PPA.

In this way, the Oracle Java 17 installer uses the local archive instead of trying to download it on its own. Make sure that the Oracle Java 17 .tar.gz downloaded from the PPA and the Oracle Java installation package are the same version, otherwise this will not work.

How to automatically accept the Oracle Java 17 license

Downloading and installing Oracle Java 17 requires the user to accept the license. In some cases, such as when using it in an automated script, you may want to use a command to automatically accept the license. You can do this using the following methods:

                        echo oracle-java17-installer shared/accepted-oracle-license-v1-3 select true | sudo /usr/bin/debconf-set-selections

If this doesn’t work, also try this command:

                        echo oracle-java17-installer shared/accepted-oracle-licence-v1-3 boolean true | sudo /usr/bin/debconf-set-selections


Related Posts