Objective
Installing Java 8 on a Raspberry Pi is similar to this one, but the Raspberry Pi does not support adding Webupd8team sources automatically with add-apt-repository, so add them manually.
Steps
Create a new webupd8team-java.list in/etc/apt/sources.list.d, add a source
sudo vim.tiny /etc/apt/sources.list.d/webupd8team-java.list
Add content, the Raspberry Pi Raspbian version used here is stretch, to change xenial to stretch, but it seems that the source does not update the corresponding version, so use the old version xenial
deb http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main
After saving the Apt-get update update, an error occurred "The following signature cannot be verified because there is no public key: No_pubkey c2518248eea14886", so the public key needs to be added
sudo apt-get install dirmngrsudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys C2518248EEA14886sudo apt-get update
Then install the Oracle-java8-installer, determine the operation in the process can be
sudo apt-get install oracle-java8-installer
After the installation is complete java-version view version, display
java version "1.8.0_171"Java(TM) SE Runtime Environment (build 1.8.0_171-b11)Java HotSpot(TM) Client VM (build 25.171-b11, mixed mode)
Raspberry Pi installs Java 8 using PPA