Hello, friends. In this post, you will learn how to install Oracle Java 17 on Debian 11.
Oracle Java 17 is the latest LTS version of this popular programming language. Although many people still use version 11, the truth is that this new LTS will be adopted progressively.
As we know, Oracle’s version differs from the OpenJDK in part due to the Linux community and the different treatment between licenses. However, many may find it important to install the Oracle version.
So, in this post, we will help you with the task.
Install Oracle Java 17 on Debian 11
The first thing to do is to open a terminal and make sure that the system is completely up-to-date.
So to complete this, run this pair of commands
sudo apt update
sudo apt upgrade
It is necessary that the gnupg2
package is installed. To do this run.
sudo apt install gnupg2
Then, add the LinuxUprising repository, which contains a package that facilitates the process.
echo "deb http://ppa.launchpad.net/linuxuprising/java/ubuntu focal main" | sudo tee /etc/apt/sources.list.d/linuxuprising-java.list
You will get a screen output similar to this one
deb http://ppa.launchpad.net/linuxuprising/java/ubuntu focal main
To avoid security issues with the system, add the GPG key from this repository before using it.
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 73C3DB2A
Output:
Executing: /tmp/apt-key-gpghome.c0JK1d3zDK/gpg.1.sh --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 73C3DB2A
gpg: key EA8CACC073C3DB2A: public key "Launchpad PPA for Linux Uprising" imported
gpg: Total number processed: 1
gpg: imported: 1
Now refresh APT.
sudo apt update
Then just install the oracle-java17-installer
package.
sudo apt install oracle-java17-installer
If you want Oracle Java 17 to become the default version of the system, then add the --install-recommends
option leaving the command
sudo apt install oracle-java17-installer --install-recommends
When the package is installed, it will show us the license terms that we must accept. Once we accept them, the download and installation process of Oracle Java 17 will start.
To verify the changes, you can run:
java --version
And then:
javac --version
Then you will know that Oracle Java 17 is installed on the system and is ready for you to use it.
So enjoy it and start working with it.
Conclusion
Thanks to this post, you have learned how to install Oracle Java 17 LTS on Debian 11. Now you can use it in your projects and other things.
Thanks for reading.