$ sudo apt-get install oracle-java8-installer 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 
6

2 Answers

I still use java version 8 and follow these steps to install via command line whenever I nuke an OS

add the discontinued repository, it will automatically install the repository for the newer version but will not prevent you from installing previous versions of java

sudo add-apt-repository ppa:webupd8team/java && sudo apt-get update 

install java version 8 default, jre or jdk

sudo apt-get install oracle-java8-set-default # or sudo apt install openjdk-8-jdk # or sudo apt install openjdk-8-jre 

verify your version of java

java -version 

set your environment variables

export JAVA_HOME=/usr/lib/jvm/java-8-oracle export JRE_HOME=/usr/lib/jvm/java-8-oracle/jre 
0

Oracle recently changed the licensing for their JDK/JRE to require everybody to have a subscription to get newer releases than 8u201. You can either switch to another JDK or buy the subscription and download/install the new oracle-jdk package manually.

Most software should run fine with openjdk-8-* - this might therefore be a worthwhile first test.