A quick guide on how to install the latest Java 17 in Ubuntu 22.04, 22.10 and Linux Mint 21.x.
A while back, Oracle announced the release of Java 17, the LTS version of this widely used programming language. This release gets support for 8-years, which includes security and performance updates and, of course, bug fixes. Java 17 is officially supported until 2029.
Although this guide tested for ongoing supported Ubuntu and Linux Mint releases, however, should be applicable for other Debian-based distributions in the coming days. Because the PPA that is used in this guide is periodically updated to meet the needs for past and future releases.
Installing Java 17 is not that straightforward without a PPA. Because it’s a licensed product, you don’t get it in the Ubuntu official repo. There are other alternatives to Oracle Java, such as OpenJDK, which is easier to install. But they lack certain functionalities due to terms and conditions from Oracle and may not be suitable for your needs.
Install Java 17 in Ubuntu, Linux Mint
- Open a terminal window (CTRL+ALT+T).
- Add the following PPA.
sudo add-apt-repository ppa:linuxuprising/java
- Refresh your system and install Java 17 using the following command.
sudo apt-get update sudo apt-get install oracle-java17-installer oracle-java17-set-default
- This command will directly download the latest Java 17 from the Oracle website. Wait till the download and installation to complete.
- During installation, you need to accept specific usage terms of Oracle for successful installation.
- After completion, type below to check the Java version.
java --version
- You should see Java 17 in the prompt. You can also check out the Java executable path via the below command:
which java
Now, if you use Arch Linux or its derivatives like Manjaro – you can install Oracle Java 17 using AUR. You can refer to our guide on how to install Oracle Java 17 in Arch Linux here. The AUR package is updated with the latest version 17.
Note that this guide also applies to Ubuntu 20.04 LTS and Linux Mint 20.
So, that’s about it. You can now work with your Java programming or projects for your development work.