Cannot update Java on Raspberry

because of an update issue I had to reinstall my Raspberry. But I cannot update Java right now, I don’t know why.

When I’m doing following:

echo "deb xenial main" | sudo tee etc/apt/sources.list.d/webupd8team-java.list  
echo "deb-src xenial main" | sudo tee -a /etc/apt/sources.list.d/webupd8team-java.list

sudo apt-key adv --keyserver hkp:// --recv-keys EEA14886

sudo apt-get update

sudo apt-get install oracle-java8-installer

I will get this message:

Reading package lists... Done
Building dependency tree
Reading state information... Done
Package oracle-java8-installer is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'oracle-java8-installer' has no installation candidate

What can I do?


I believe Oracle has dropped support for Java 8 recently. If you are on an RPi you shouldn’t be running Oracle Java anyway. You should be using Zulu Java 8.

Use the 32-bit Java 8 version for the RPi.

Or, use openHABian and it will download and install the best versions of everything you need to run openHAB. You don’t have to use the SD card image. There are manual instructions to configure everything for you.

I had the same problem, ended up switching my pi over to OpenJDK. It ended up with openjdk version “1.8.0_212”. I have been running openHAB for a few weeks now without issue.

I’m pretty sure when I installed OpenJDK it switched over from the Oracle to OpenJDK.
sudo apt-get install openjdk-8-jdk