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

1 Answer 1


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:

  • Hmm when I do apt-cache search openjdk I can only see openjdk-7 packages and not openjdk-8 packages And when I run sudo apt-get install openjdk-8-jdk it says: Reading package lists... Done Building dependency tree Reading state information... Done Package openjdk-8-jdk 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 'openjdk-8-jdk' has no installation candidate Really wired :/
    – Dominik
    Jun 22, 2019 at 22:48
  • Oh shoot, sorry. Debian 8 is the "oldstable". You can install the OpenJDK 7 package, or use "Adopt OpenJDK": adoptopenjdk.net/installation.html#linux-pkg
    – Apache
    Jun 23, 2019 at 23:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .