For Java developers and/or apps, here’s how to install and setup the Oracle Java 17 LTS in Debian 11 Bullseye.
Like other Linux Distributions, Debian includes the open-source Java platform ‘OpenJDK‘ in its main repositories. Users may install it simply by running
sudo apt install default-jdk command in terminal.
However, due to license issue Oracle Java is excluded from Linux repository. Users have to install it manually from Oracle website. And here’s how to do the trick in Debian 11.
Install Java JDK 17 in Debian 11
Oracle Java 17 is a long term support (LTS) release with 8 years security, performance, and bug-fix updates until 2029.
To make the installation easy, a well trusted Ubuntu PPA contains the installer script that automatically download, install and setup the programming language. And it works on Debian though made for Ubuntu users.
1. Download & run the Java installer:
Search for and open a ‘terminal’ window or connect to the command console. Then, run command to install wget if you don’t have it:
sudo apt install wget
Next, download the installer script by running command:
wget -c http://ppa.launchpad.net/linuxuprising/java/ubuntu/pool/main/o/oracle-java17-installer/oracle-java17-installer_17-1~linuxuprising5_amd64.deb
For arm64 processors, such as Apple Silicon and Raspberry Pi, grab the installer from THIS PAGE.
Finally, run apt command to install the script which will start installing Java 17 automatically.
sudo apt install ./oracle-java17-installer*.deb
2. Accept License:
Once the installing process starts, it brings you into Oracle No-Fee Terms and Conditions screen. Press Tab key on keyboard to select OK and hit Enter.
Next, use left arrow key to choose Yes and hit Enter to accept the license.
Now it should start downloading & installing Java. Depends on your internet connection, the process may take a few minutes.
Set Java JDK 17 as Default in Debian 11
After successfully installed the Java platform, download another script from the PPA by running command:
wget -c http://ppa.launchpad.net/linuxuprising/java/ubuntu/pool/main/o/oracle-java17-installer/oracle-java17-set-default_17-1~linuxuprising5_all.deb
Next, install it will automatically set Java 17 as default in your system:
sudo apt install ./oracle-java17-set-default*.deb
When everything’s done sucessfully, use ‘
java --version‘ command to verify the change. It will output something like this:
java 17 2021-09-14 LTS
Java(TM) SE Runtime Environment (build 17+35-LTS-2724)
Java HotSpot(TM) 64-Bit Server VM (build 17+35-LTS-2724, mixed mode, sharing)
That’s all. Enjoy!