How to install Java 17 on Ubuntu 21.10. Java is a high-level object-oriented programming language and computing platform intended to let application developers write once and run everywhere. This means that a compiled java code runs on all platforms that support Java without the need for recompilation. JDK is a collection of various programming tools such as JRE(Java Runtime Environment), Java, Javac, Jar, and many others. Java 17 LTS is the latest long-term support release for the Java SE platform.
Java OpenJDK 17 is an open-source implementation of the Java SE platform. Since the OpenJDK versions available in the default repositories are not up to date, we will have to download the Open-source JDK 17 using the Wget command.
Install OpenJDK
Step 1. Open the terminal (Ctrl+Alt+T) and update the package repository to ensure you download the latest software version:
$ sudo apt update
Step 2. Then, you can confidently install the latest Java Development Kit with the following command:
$ sudo apt install default-jdk
Install official Oracle Java
To download the official Oracle JDK, you first need to download a third-party repository.
I will include instructions for installations from Webupd8 PPA repositories.
Download Oracle Java from Webupd8 PPA
Step 1. First, add the required package repository by typing:
$ sudo add-apt-repository ppa:webupd8team/java
Step 2. Make sure to update your system before initiating any installation:
$ sudo apt update
Step 3. Now, you can install Java 17, the latest LTS version:
$ sudo apt install oracle-java11-installer
Step 4. Optionally, you can set this Java version as the default with the following command:
$ sudo apt install oracle-java11-set-default
Verify Java is Installed on Your System
To check the version of Java running, use the command:
$ java –version
Conclusion
This post has shown you how to install Java on Ubuntu.