How to Install JAVA on Debian 10. Terminal commands to install JAVA OpenJDK, and Oracle JDK on Debian 10. Users can install Oracle Java 8, Oracle Java 11 and Oracle Java 12 on Debian 10.
NOTE 1
There are two different implementations of Java, OpenJDK and Oracle Java. The JDK is a development environment for building applications, and components using the Java programming language. The JDK includes tools useful for developing and testing programs written in the Java programming language and running on the Java platform. The Debian 10 repositories {default} comes with two different Java packages – Java Runtime Environment (JRE – including Java virtual machine) and Java Development Kit (JDK).
Note 2
The Oracle JDK License has changed for releases starting April 16, 2019. The new Oracle Technology Network License Agreement for Oracle Java SE is substantially different from prior Oracle JDK licenses. The new license permits certain uses, such as personal use and development use, at no cost — but other uses authorized under prior Oracle JDK licenses may no longer be available. Please review the terms carefully before downloading and using this product. An FAQ is available here.
Commercial license and support is available with a low cost Java SE Subscription. Oracle also provides the latest OpenJDK release under the open source GPL License at jdk.java.net.
Install Oracle Java 12 on Debian 10
To successfully install Oracle Java 12 on Debian 10 buster, you need to append the Linux Uprising Java repository as shown.
$ sudo echo "deb http://ppa.launchpad.net/linuxuprising/java/ubuntu bionic main" | sudo tee etc/apt/sources.list.d/linuxuprising-java.list
$ sudo apt install dirmngr
$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 73C3DB2A
$ sudo apt update
$ sudo apt install oracle-java12-installer
Next a pop-up window will be displayed. Hit on the TAB button to navigate to the ‘OK’ option and press ENTER. In the next windows, navigate to the ‘yes’ option with the cursor keys and hit ENTER to accept the license agreements.
Now check the version of Oracle Java 12 run.
$ java --version
Install Oracle Java 11 on Debian 10
To install OpenJDK 11 on Debian 10, login as a regular user with sudo privileges and update the system packages. First of all, Login to Debian 10 Buster system as the sudo user and install some required packages on your Debian system.
$ sudo -i
$ apt install wget libasound2 libasound2-data
$ sudo apt update
$ sudo apt install default-jdk
Once the installation is complete, you can verify it by checking the Java version:
$ java -version
The output should look something like this:
openjdk version "11.0.3" 2019-04-16
OpenJDK Runtime Environment (build 11.0.3+7-post-Debian-5)
OpenJDK 64-Bit Server VM (build 11.0.3+7-post-Debian-5, mixed mode, sharing)
That’s it! At this point, you have successfully installed Java on your Debian system.
Install Oracle Java 8 on Debian 10
$ sudo apt update
$ sudo apt install apt-transport-https ca-certificates wget dirmngr gnupg software-properties-common
$ wget -qO - https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public | sudo apt-key add -
$ sudo add-apt-repository --yes https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/
$ sudo apt update
$ sudo apt install adoptopenjdk-8-hotspot
Finally, verify the installation by checking the Java version:
$ java -version
The output should look something like this:
openjdk version "1.8.0_212"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_212-b04)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.212-b04, mixed mode)
You can also download JAVA from:
https://www.oracle.com/technetwork/java/javase/downloads/jdk11-downloads-5066655.html