1

I get the following error while installing jdk 8 in my 64-bit kali linux.

root@kali:~# apt-get install oracle-java8-installer 
Reading package lists... Done
Building dependency tree        
Reading state information... Done
oracle-java8-installer is already the newest version (8u111+8u111arm-1~webupd8~0).
The following packages were automatically installed and are no longer required:
  aapt android-libaapt android-libandroidfw android-libbacktrace android-libbase
  android-libcutils android-liblog android-libunwind android-libutils android-libziparchive
  fastjar fonts-dejavu-extra jarwrapper java-wrappers junit libadns1 libantlr-java
  libantlr3-runtime-java libapache-pom-java libatinject-jsr330-api-java libatk-wrapper-java
  libatk-wrapper-java-jni libcommons-cli-java libcommons-io-java libcommons-lang3-java
  libcommons-parent-java libcrypto++6 libguava-java libice-dev libjaxp1.3-java libjsr305-java
  libpthread-stubs0-dev libsm-dev libsmali-java libstringtemplate-java libx11-dev libx11-doc
  libxau-dev libxcb1-dev libxdmcp-dev libxmlunit-java libxpp3-java libxt-dev
  libyaml-snake-java python-adns python-easygui python-levenshtein python-metaconfig
  python-pycryptopp python-pysnmp4 python-pysnmp4-apps python-pysnmp4-mibs smitools
  x11proto-core-dev x11proto-input-dev x11proto-kb-dev xorg-sgml-doctools xtrans-dev
Use 'apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 1463 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
Setting up oracle-java8-installer (8u111+8u111arm-1~webupd8~0) ...
Using wget settings from /var/cache/oracle-jdk8-installer/wgetrc
Downloading Oracle Java 8...
--2016-12-16 21:05:09--  http://download.oracle.com/otn-pub/java/jdk/8u111-b14/jdk-8u111-linux-x64.tar.gz
Resolving false (false)... failed: Name or service not known.
wget: unable to resolve host address ‘false’
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)

I have searched a lot about this but couldn't figure out what's causing it.

If I run wget http://download.oracle.com/otn-pub/java/jdk/8u111-b14/jdk-8u111-linux-x64.tar.gz it works fine.

Also nslookup google.com and ping google.com works without error.

Also I deleted everything that was there in the file /var/cache/oracle-jdk8-installer/wgetrc but again the same problem.

Please help!

4

That's peculiar issue.

DNS is not failing for some strange reason, your DNS is working fine. However the package you're attempting seems with a broken post-install script, which is taking "false" as a hostname and passing this to wget, instead of the expected hostname.

It is pretty obvious from the output:

...

--2016-12-16 21:05:09-- http://download.oracle.com/otn-pub/java/jdk/8u111-b14/jdk-8u111-linux-x64.tar.gz

Resolving false (false)... failed: Name or service not known.

wget: unable to resolve host address ‘false’

If I wanted to dig deeper into it, I'd have a look in /var/cache/oracle-jdk8-installer/wgetrc to see if there is something broken there, also apt-get clean and retry.

I would suggest you to try achieving this result - installing java with alternative method, e.g. described here http://www.2daygeek.com/install-oracle-java-using-java-alternatives-method-on-ubuntu-centos-debian-fedora-mint-rhel-opensuse/ and see if it works out for you - probably this will be the fastest.

| improve this answer | |
  • I don't know if its relevant but here's another piece of information. Earlier I was getting "hostname can not be blank" error in java while downloading a package using eclipse. So, I uninstalled java and now installing java again. – Lokesh Dec 16 '16 at 16:42
  • I managed to pull the post install script. Here it is gist.github.com/lokeshh/de38793c7fa9fe3955f299d0c173fdb3 – Lokesh Dec 16 '16 at 16:53
  • This issue is resolved but still my eclipse issue isn't resolved yet. @Niklai do you mind taking a look at here – Lokesh Dec 16 '16 at 17:44
3

I've figured out the problem after going through the post install script. The problem was in /etc/apt/apt.conf. It was miss-configured as Acquire::http::Proxy "false". This worked for apt but other programs like this script weren't able to work because of this. I remove this line and now the problem is gone.

Thanks @Nikolai for the suggestion about the post install script.

| improve this answer | |
  • Glad to see you've resolved it. – Nikolai Alexandrov Georgiev Dec 20 '16 at 8:18
  • Thanks! I had a really old /etc/apt/apt.conf last modified Aug 2006 (lots of Ubuntu updates after another...), after removing it I can finally update the Oracle JDK automatically. – Stefan L Jan 30 '18 at 22:31
1

Add "use_proxy=no" in /var/cache/oracle-jdk8-installer/wgetrc and re-try the below command: apt-get install oracle-java8-installer

For me, it worked.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.