For me non of the above worked and I had to do as below, and it worked,
sudo -E add-apt-repository ppa:openjdk-r/ppa
and then,
sudo apt-get update
sudo apt-get install openjdk-8-jdk
Reference: https://askubuntu.com/questions/644188/updating-jdk-7-to-8-unable-to-locate-package