[Unstable] How to install openjdk-8-jdk on Raspbian Buster armhf

**Bazel_bin**　[![GitHub stars](https://img.shields.io/github/stars/PINTO0309/Bazel_bin.svg?style=social&label=Stars)](https://github.com/PINTO0309/Bazel_bin)
<a href="https://github.com/pinto0309/Bazel_bin"><img src="https://github-link-card.s3.ap-northeast-1.amazonaws.com/pinto0309/Bazel_bin.png" width="460px"></a>

# １．Introduction

<font color="red">**[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](https://qiita.com/PINTO/items/612718c0ce4f1def6c6e)**</font>

In Raspbian Buster, 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](https://qiita.com/PINTO/items/5445c5e899f68d928f0d) for the procedure by Debian Buster.**

# ２．Procedure

```console:Edit_sources.list
$ sudo nano /etc/apt/sources.list
```

Add the following **`deb http://...`** to the bottom line.

```console:Add_the_following_line
deb http://deb.debian.org/debian/ sid main
```
Quit Nano editor.
<kbd>Ctrl</kbd>+<kbd>O</kbd>
<kbd>Ctrl</kbd>+<kbd>X</kbd>


```console:Install_openjdk-8-jdk
$ sudo apt-get install -y debian-keyring debian-archive-keyring
$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 04EE7237B7D453EC
$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 648ACFD622F3D138
$ sudo apt-get update
$ sudo apt-get install -y openjdk-8-jdk
```

```console:Java_version_switch
$ 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
```

```console:Javac_version_switch
$ 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
```

```console:Java_version_check
$ 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
```

```console:Edit_sources.list
$ sudo nano /etc/apt/sources.list
```

Delete the following **`deb http://...`** from the bottom line.

```console:Delete_the_following_line
deb http://deb.debian.org/debian/ sid main
```
Quit Nano editor.
<kbd>Ctrl</kbd>+<kbd>O</kbd>
<kbd>Ctrl</kbd>+<kbd>X</kbd>

```console:
$ sudo apt-get update
```

# ３．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**
**[apt-get updateで、There is no public key available と出た時の対処。 - d6rkaiz - Qiita](https://qiita.com/d6rkaiz/items/a8cb22f764bcfbe5acaf)**