Ubuntu: Oracle JDK 8 is NOT installed

Try this,

First update the apt-get repos

$ sudo apt-get update

Add the java 8 repo to apt-get

$ sudo add-apt-repository ppa:webupd8team/java

Again update the apt-get repo

$ sudo apt-get update

Finally install java 8

$ sudo apt-get install oracle-java8-installer

References:

  • Ubuntu 16.04
  • Ubuntu 18.04

I suspect you've installed Oracle JDK8 using the archive, extracting to your own folder. It's probably the case that Ubuntu doesn't know that you've installed Java as the system Java and so is raising the error.

To be honest, I'm not sure how you go about installing it for system wide use but this page may provide some pointers. Installing Open JDK might be the better option, but an option is also given here, and this answer might also help.


the first step:

sudo apt-get remove oracle-java8-installer

to clean up the failure installation of java8 perviously.

the second step:

sudo apt-get install oracle-java8-installer

to reinstall Java8


oracle-java8-installer is not able to download file. So downlaod it manually from Oracle site and put into folder /var/cache/oracle-jdk8-installer/. And try to install oracle-java8-installer again. This solved the problem for me.

Step by step:

  • Check what file oracle-java8-installer is not able to download. You can see it in installation log. Let's suppose it's jdk-8u111-linux-x64.tar.gz
  • Google it jdk-8u111-linux-x64.tar.gz and you'll find exact page on Oracle site where to download it from. For our example it's http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
  • Download jdk-8u111-linux-x64.tar.gz file and put in into folder /var/cache/oracle-jdk8-installer/.
  • And try to install oracle-jdk8-installer again: sudo apt-get install oracle-java8-installer Installation should finish successfully.