Ubuntu: Oracle JDK 8 not installed

I 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 limited, so the oracle server will not let me 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:

 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 will not complete the installation.

+14
java java-8 ubuntu apt-get
source share
6 answers

I suspect that you installed Oracle JDK8 using the archive, extracting it to your own folder. Ubuntu probably doesnโ€™t know that you installed Java as your Java system, and therefore an error occurs.

To be honest, I'm not sure how you are going to install it for system use, but this page may contain some pointers. Installing an Open JDK may be a better option, but an option is also provided here , and this answer may also help.

+2
source share

oracle-java8-installer cannot load the file. Therefore, it is downlaod manually from the Oracle site and placed in the /var/cache/oracle-jdk8-installer/ folder. And try installing oracle-java8-installer again. This should solve the problem.

Step by step:

  • Verify that the oracle-java8-installer file cannot load. You can see it in the installation log. Let jdk-8u111-linux-x64.tar.gz
  • Google it jdk-8u111-linux-x64.tar.gz and you will find the exact page on the Oracle website where to download it from. For our example, this is http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
  • Download the jdk-8u111-linux-x64.tar.gz and enter it in the /var/cache/oracle-jdk8-installer/ folder.
  • And try installing oracle-jdk8-installer again: sudo apt-get install oracle-java8-installer installation should complete successfully.
+11
source share

Try this,

Update apt-get repositories first

 $ sudo apt-get update 

Add java 8 repository to apt-get

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

Update the apt-get repository again

 $ sudo apt-get update 

Finally install Java 8

 $ sudo apt-get install oracle-java8-installer 

Recommendations :

+4
source share

first step:

 sudo apt-get remove oracle-java8-installer 

clear java8 installation failure previously.

second step:

 sudo apt-get install oracle-java8-installer 

reinstall java8

+4
source share

One of the possible reasons and solutions may be that the version of the java package has been updated to fix a possible fix for the vulnerability, and this should be updated in the PPA. I came across this when installing on Ubuntu 16.04.

If the specific download error is that the Java download link is 404, then basically this solution will work .

Please remember to update the versions accordingly.

+1
source share

This worked for me:

  • First, follow the path below:

    cd / var / lib / dpkg / info

Run all 4 sed commands:

 sudo sed -i 's|JAVA_VERSION=8u161|JAVA_VERSION=8u172|' oracle-java8-installer.* sudo sed -i 's|PARTNER_URL=http://download.oracle.com/otn-pub/java/jdk/8u161-b12/2f38c3b165be4555a1fa6e98c45e0808/|PARTNER_URL=http://download.oracle.com/otn-pub/java/jdk/8u172-b11/a58eab1ec242421181065cdc37240b08/|' oracle-java8-installer.* sudo sed -i 's|SHA256SUM_TGZ="6dbc56a0e3310b69e91bb64db63a485bd7b6a8083f08e48047276380a0e2021e"|SHA256SUM_TGZ="28a00b9400b6913563553e09e8024c286b506d8523334c93ddec6c9ec7e9d346"|' oracle-java8-installer.* sudo sed -i 's|J_DIR=jdk1.8.0_161|J_DIR=jdk1.8.0_172|' oracle-java8-installer.* 
  • Secondly:

    sudo apt-get install oracle-java8-installer

0
source share

All Articles