Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ubuntu: Oracle JDK 8 is NOT installed

I've installed oracle JDK-8 on ubuntu 14.04 manually. but whenever I want to install a package that needs jdk8, apt-get tries to install jdk 8 again. my country is restricted so oracle server won't allow me to download jdk8.

$java -version

java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)

and the results of apt-get are:

download failed
Oracle JDK 8 is NOT installed.
dpkg: error processing package oracle-java8-installer (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 oracle-java8-installer
E: Sub-process /usr/bin/dpkg returned an error code (1)

with this error, apt-get won't finish the installation.

like image 804
batroudoroch Avatar asked Sep 24 '15 09:09

batroudoroch


3 Answers

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.
like image 136
Viktor Kruglikov Avatar answered Oct 12 '22 15:10

Viktor Kruglikov


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
like image 26
tk_ Avatar answered Oct 12 '22 15:10

tk_


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

like image 41
Ivan Lee Avatar answered Oct 12 '22 16:10

Ivan Lee