Java installation error on Debian 8

I followed the instructions from this website: https://www.digitalocean.com/community/tutorials/how-to-install-java-with-apt-get-on-debian-8

When I install jre and jdk it says:

Reading package lists... Done
Building dependency tree
Reading state information... Done
default-jdk is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.

So I followed the instruction to the point:

sudo apt-get install oracle-java8-installer

After that it says:

    Building dependency tree 
    Reading state information... Done  
    E: Unable to locate package oracle-java8-installer

And when I run java -version or javac -version

It says:

bash: java: command not found

This article you followed is outdated as the "PPA" it tries to add and use does not exist anymore. Worry not, I believe you are better off without Oracle's package anyway.

So, how do you get Java?
Simply install one of the so called openjdk packages.
You can get a list of them by using the command: apt-cache search openjdk and then using sudo apt-get install PACKAGENAME.
I believe you are looking for openjdk-8-jdk, which can be installed by using:
sudo apt-get install openjdk-8-jdk.

These packages work just as well as the Oracle one did/does.

Here is an online list of these packages:
https://packages.debian.org/search?keywords=openjdk&searchon=names&suite=stable&section=all