1.Introduction
[October 20, 2019] This procedure is deprecated at this time. Click here for the stable procedure. [Stable] Install openjdk-8-jdk safely in Raspbian Buster (Debian 10) environment
In Debian Buster (Debian 10), openjdk-8-jdk is excluded from the supported packages. The procedure for installing openjdk-8-jdk is described below. The same procedure works for other architectures such as aarch64 and x86_64 and other.
Click here for the procedure by Raspbian Buster.
2.Procedure
$ sudo nano /etc/apt/sources.list
Add the following deb http://...
to the bottom line.
deb http://deb.debian.org/debian/ sid main
Quit Nano editor.
Ctrl+O
Ctrl+X
$ sudo apt-get update
$ sudo apt-get install -y openjdk-8-jdk
$ sudo update-alternatives --config java
There are 2 choices for the alternative java (providing /usr/bin/java).
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/lib/jvm/java-11-openjdk-armhf/bin/java 1111 auto mode
1 /usr/lib/jvm/java-11-openjdk-armhf/bin/java 1111 manual mode
2 /usr/lib/jvm/java-8-openjdk-armhf/jre/bin/java 1081 manual mode
Press <enter> to keep the current choice[*], or type selection number: 2
$ sudo update-alternatives --config javac
There are 2 choices for the alternative javac (providing /usr/bin/javac).
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/lib/jvm/java-11-openjdk-armhf/bin/javac 1111 auto mode
1 /usr/lib/jvm/java-11-openjdk-armhf/bin/javac 1111 manual mode
2 /usr/lib/jvm/java-8-openjdk-armhf/bin/javac 1081 manual mode
Press <enter> to keep the current choice[*], or type selection number: 2
$ java -version
openjdk version "1.8.0_222"
OpenJDK Runtime Environment (build 1.8.0_222-8u222-b10-1-b10)
OpenJDK Client VM (build 25.222-b10, mixed mode)
$ javac -version
javac 1.8.0_222
$ sudo nano /etc/apt/sources.list
Delete the following deb http://...
from the bottom line.
deb http://deb.debian.org/debian/ sid main
Quit Nano editor.
Ctrl+O
Ctrl+X
$ sudo apt-get update
3.Reference articles
https://novicestuffs.wordpress.com/2017/04/25/how-to-uninstall-java-from-linux/
https://stackoverflow.com/questions/57031649/how-to-install-openjdk-8-jdk-on-debian-10-buster