[Stable] Install openjdk-8-jdk safely in Raspbian Buster (Debian 10) environment

# １．Introduction
My past article **[How to install openjdk-8-jdk on Raspbian Buster armhf](https://qiita.com/PINTO/items/a6ae8e04d382493ef369)** and **[How to install openjdk-8-jdk on Debian Buster (Debian 10) armhf](https://qiita.com/PINTO/items/5445c5e899f68d928f0d)** procedure required installing an unstable "sid" package, which caused glibc2.29 to be installed without permission. This time I will describe the procedure for installing openjdk-8-jdk without installing the unstable "sid" package and keeping the whole environment correct. The standard glibc for Raspbian Buster (Debian 10) is **`glibc2.28`**. Note that openjdk-8-jdk is required to build Bazel.

# ２．Environment

- RaspberryPi3 / 4
- Raspbian Buster (Debian 10)
- openjdk-8-jdk

# ３．Procedure

```console:Advance_preparation
$ cd ~
$ sudo apt-get update
$ sudo apt-get install -y \
    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 nano /etc/apt/sources.list

### Add the following line to the last line
deb https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/ buster main Release
```

<kbd>Ctrl</kbd> + <kbd>O</kbd>
<kbd>Ctrl</kbd> + <kbd>X</kbd>

```console:Install_openjdk-8-jdk
### A warning message appears several times, but you can ignore it.
$ sudo apt-get update
$ sudo apt-get install adoptopenjdk-8-hotspot
$ sudo nano /etc/apt/sources.list

### Delete the following line to the last line
deb https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/ buster main Release
```

<kbd>Ctrl</kbd> + <kbd>O</kbd>
<kbd>Ctrl</kbd> + <kbd>X</kbd>

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

![Terminal - pi@raspberrypi: ~_033.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/194769/b7016519-241c-a6ca-aba4-f68ba8678cd1.png)

# ４．Appendix
You can also try the standalone installer with a deb file.
1. **[openjdk-8-jdk for armhf (.deb) download link](https://drive.google.com/open?id=1LQUSal55R6fmawZS9zZuk6-5ZFOdUqRK)**
2. **[openjdk-8-jdk for aarch64 (.deb) download link](https://drive.google.com/open?id=1VwLxzT3EOTbhSzwvRF2H4ChTQyTQBt3x)**

```console:For_armhf
$ curl -sc /tmp/cookie "https://drive.google.com/uc?export=download&id=1LQUSal55R6fmawZS9zZuk6-5ZFOdUqRK" > /dev/null
$ CODE="$(awk '/_warning_/ {print $NF}' /tmp/cookie)"
$ curl -Lb /tmp/cookie "https://drive.google.com/uc?export=download&confirm=${CODE}&id=1LQUSal55R6fmawZS9zZuk6-5ZFOdUqRK" -o adoptopenjdk-8-hotspot_8u222-b10-2_armhf.deb

$ sudo apt-get install -y ./adoptopenjdk-8-hotspot_8u222-b10-2_armhf.deb
```

```console:For_aarch64
$ curl -sc /tmp/cookie "https://drive.google.com/uc?export=download&id=1VwLxzT3EOTbhSzwvRF2H4ChTQyTQBt3x" > /dev/null
$ CODE="$(awk '/_warning_/ {print $NF}' /tmp/cookie)"
$ curl -Lb /tmp/cookie "https://drive.google.com/uc?export=download&confirm=${CODE}&id=1VwLxzT3EOTbhSzwvRF2H4ChTQyTQBt3x" -o adoptopenjdk-8-hotspot_8u222-b10-2_arm64.deb

$ sudo apt-get install -y ./adoptopenjdk-8-hotspot_8u222-b10-2_arm64.deb
```

# ５．Reference articles

**https://linuxize.com/post/install-java-on-debian-10/#installing-openjdk-8**
**https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/pool/main/a/adoptopenjdk-8-hotspot/**