WSL: Cannot install Oracle JDK 8

I’m having trouble running Oracle Java JDK. I’ve tried two different methods, both fails.

Running build 14332.

Method 1: Manual installation

  1. Download tar and unpack: user@mymachine:~/tmp$ tar zxvf jdk-8u92-linux-x64.tar.gz
  2. Run java:
cd jdk1.8.0_92/bin
./java -version

Result: Nothing happens, just a blinking cursor.

Method 2: Webupd8.org alternative method, described here: http://www.webupd8.org/2012/09/install-oracle-java-8-in-ubuntu-via-ppa.html

user@mymachine:~$ sudo add-apt-repository ppa:webupd8team/java
user@mymachine:~$ sudo apt-get update
user@mymachine:~$ sudo apt-get install oracle-java8-installer
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
  os-prober
Use 'apt-get autoremove' to remove it.
The following extra packages will be installed:
  binutils gsfonts gsfonts-x11 java-common libfontenc1 libxfont1 x11-common
  xfonts-encodings xfonts-utils
Suggested packages:
  binutils-doc default-jre equivs binfmt-support visualvm ttf-baekmuk
  ttf-unfonts ttf-unfonts-core ttf-kochi-gothic ttf-sazanami-gothic
  ttf-kochi-mincho ttf-sazanami-mincho ttf-arphic-uming firefox firefox-2
  iceweasel mozilla-firefox iceape-browser mozilla-browser epiphany-gecko
  epiphany-webkit epiphany-browser galeon midbrowser moblin-web-browser
  xulrunner xulrunner-1.9 konqueror chromium-browser midori google-chrome
The following NEW packages will be installed:
  binutils gsfonts gsfonts-x11 java-common libfontenc1 libxfont1
  oracle-java8-installer x11-common xfonts-encodings xfonts-utils
0 upgraded, 10 newly installed, 0 to remove and 17 not upgraded.
Need to get 6,429 kB of archives.
After this operation, 19.0 MB of additional disk space will be used.
Get:1 http://ppa.launchpad.net/webupd8team/java/ubuntu/ trusty/main oracle-java8-installer all 8u92+8u91arm-2~really8u91~webupd8~0 [23.1 kB]
Get:2 http://archive.ubuntu.com/ubuntu/ trusty/main libfontenc1 amd64 1:1.1.2-1 [15.6 kB]
Get:3 http://archive.ubuntu.com/ubuntu/ trusty-updates/main libxfont1 amd64 1:1.4.7-1ubuntu0.2 [95.0 kB]
Get:4 http://archive.ubuntu.com/ubuntu/ trusty-updates/main binutils amd64 2.24-5ubuntu14 [2,076 kB]
Get:5 http://archive.ubuntu.com/ubuntu/ trusty/main java-common all 0.51 [130 kB]
Get:6 http://archive.ubuntu.com/ubuntu/ trusty/main gsfonts all 1:8.11+urwcyr1.0.7~pre44-4.2ubuntu1 [3,374 kB]
Get:7 http://archive.ubuntu.com/ubuntu/ trusty-updates/main x11-common all 1:7.7+1ubuntu8.1 [49.5 kB]
Get:8 http://archive.ubuntu.com/ubuntu/ trusty/main xfonts-encodings all 1:1.0.4-1ubuntu1 [583 kB]
Get:9 http://archive.ubuntu.com/ubuntu/ trusty/main xfonts-utils amd64 1:7.7+1 [73.9 kB]
Get:10 http://archive.ubuntu.com/ubuntu/ trusty/main gsfonts-x11 all 0.22 [9,108 B]
Fetched 6,429 kB in 11s (568 kB/s)
Preconfiguring packages ...
E: Can not write log (Is /dev/pts mounted?) - openpty (2: No such file or directory)
Selecting previously unselected package libfontenc1:amd64.
(Reading database ... 24998 files and directories currently installed.)
Preparing to unpack .../libfontenc1_1%3a1.1.2-1_amd64.deb ...
Unpacking libfontenc1:amd64 (1:1.1.2-1) ...
Selecting previously unselected package libxfont1:amd64.
Preparing to unpack .../libxfont1_1%3a1.4.7-1ubuntu0.2_amd64.deb ...
Unpacking libxfont1:amd64 (1:1.4.7-1ubuntu0.2) ...
Selecting previously unselected package binutils.
Preparing to unpack .../binutils_2.24-5ubuntu14_amd64.deb ...
Unpacking binutils (2.24-5ubuntu14) ...
Selecting previously unselected package java-common.
Preparing to unpack .../java-common_0.51_all.deb ...
Unpacking java-common (0.51) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Setting up binutils (2.24-5ubuntu14) ...
Processing triggers for libc-bin (2.19-0ubuntu6.7) ...
Selecting previously unselected package oracle-java8-installer.
(Reading database ... 25240 files and directories currently installed.)
Preparing to unpack .../oracle-java8-installer_8u92+8u91arm-2~really8u91~webupd8~0_all.deb ...
Unpacking oracle-java8-installer (8u92+8u91arm-2~really8u91~webupd8~0) ...
Selecting previously unselected package gsfonts.
Preparing to unpack .../gsfonts_1%3a8.11+urwcyr1.0.7~pre44-4.2ubuntu1_all.deb ...
Unpacking gsfonts (1:8.11+urwcyr1.0.7~pre44-4.2ubuntu1) ...
Selecting previously unselected package x11-common.
Preparing to unpack .../x11-common_1%3a7.7+1ubuntu8.1_all.deb ...
Unpacking x11-common (1:7.7+1ubuntu8.1) ...
Selecting previously unselected package xfonts-encodings.
Preparing to unpack .../xfonts-encodings_1%3a1.0.4-1ubuntu1_all.deb ...
Unpacking xfonts-encodings (1:1.0.4-1ubuntu1) ...
Selecting previously unselected package xfonts-utils.
Preparing to unpack .../xfonts-utils_1%3a7.7+1_amd64.deb ...
Unpacking xfonts-utils (1:7.7+1) ...
Selecting previously unselected package gsfonts-x11.
Preparing to unpack .../gsfonts-x11_0.22_all.deb ...
Unpacking gsfonts-x11 (0.22) ...
Processing triggers for mime-support (3.54ubuntu1.1) ...
Processing triggers for shared-mime-info (1.2-0ubuntu3) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Processing triggers for ureadahead (0.100.0-16) ...
Setting up libfontenc1:amd64 (1:1.1.2-1) ...
Setting up libxfont1:amd64 (1:1.4.7-1ubuntu0.2) ...
Setting up java-common (0.51) ...
Setting up oracle-java8-installer (8u92+8u91arm-2~really8u91~webupd8~0) ...
No /var/cache/oracle-jdk8-installer/wgetrc file found.
Creating /var/cache/oracle-jdk8-installer/wgetrc and
using default oracle-java8-installer wgetrc settings for it.
Downloading Oracle Java 8...
--2016-05-02 11:25:09--  http://download.oracle.com/otn-pub/java/jdk/8u91-b14/jdk-8u91-linux-x64.tar.gz
Resolving download.oracle.com (download.oracle.com)... 104.84.152.122, 104.84.152.154
Connecting to download.oracle.com (download.oracle.com)|104.84.152.122|:80... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://edelivery.oracle.com/otn-pub/java/jdk/8u91-b14/jdk-8u91-linux-x64.tar.gz [following]
--2016-05-02 11:25:09--  https://edelivery.oracle.com/otn-pub/java/jdk/8u91-b14/jdk-8u91-linux-x64.tar.gz
Resolving edelivery.oracle.com (edelivery.oracle.com)... 95.101.97.55
Connecting to edelivery.oracle.com (edelivery.oracle.com)|95.101.97.55|:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: http://download.oracle.com/otn-pub/java/jdk/8u91-b14/jdk-8u91-linux-x64.tar.gz?AuthParam=1462188430_f623df5ced151fc3d3a4a42b03603b68 [following]
--2016-05-02 11:25:10--  http://download.oracle.com/otn-pub/java/jdk/8u91-b14/jdk-8u91-linux-x64.tar.gz?AuthParam=1462188430_f623df5ced151fc3d3a4a42b03603b68
Connecting to download.oracle.com (download.oracle.com)|104.84.152.122|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 181367942 (173M) [application/x-gzip]
Saving to: ‘jdk-8u91-linux-x64.tar.gz’

     0K ........ ........ ........ ........ ........ ........  1% 18.3M 9s
  3072K ........ ........ ........ ........ ........ ........  3% 15.1M 10s
  6144K ........ ........ ........ ........ ........ ........  5% 15.3M 10s
  9216K ........ ........ ........ ........ ........ ........  6% 18.5M 10s
 12288K ........ ........ ........ ........ ........ ........  8% 17.7M 9s
 15360K ........ ........ ........ ........ ........ ........ 10% 17.7M 9s
 18432K ........ ........ ........ ........ ........ ........ 12% 17.4M 9s
 21504K ........ ........ ........ ........ ........ ........ 13% 19.8M 9s
 24576K ........ ........ ........ ........ ........ ........ 15% 16.5M 8s
 27648K ........ ........ ........ ........ ........ ........ 17% 17.8M 8s
 30720K ........ ........ ........ ........ ........ ........ 19% 17.7M 8s
 33792K ........ ........ ........ ........ ........ ........ 20% 17.7M 8s
 36864K ........ ........ ........ ........ ........ ........ 22% 19.0M 8s
 39936K ........ ........ ........ ........ ........ ........ 24% 17.2M 7s
 43008K ........ ........ ........ ........ ........ ........ 26% 19.2M 7s
 46080K ........ ........ ........ ........ ........ ........ 27% 14.9M 7s
 49152K ........ ........ ........ ........ ........ ........ 29% 23.0M 7s
 52224K ........ ........ ........ ........ ........ ........ 31% 15.7M 7s
 55296K ........ ........ ........ ........ ........ ........ 32% 18.1M 7s
 58368K ........ ........ ........ ........ ........ ........ 34% 17.2M 6s
 61440K ........ ........ ........ ........ ........ ........ 36% 19.1M 6s
 64512K ........ ........ ........ ........ ........ ........ 38% 17.3M 6s
 67584K ........ ........ ........ ........ ........ ........ 39% 17.3M 6s
 70656K ........ ........ ........ ........ ........ ........ 41% 14.5M 6s
 73728K ........ ........ ........ ........ ........ ........ 43% 20.2M 6s
 76800K ........ ........ ........ ........ ........ ........ 45% 17.9M 5s
 79872K ........ ........ ........ ........ ........ ........ 46% 15.3M 5s
 82944K ........ ........ ........ ........ ........ ........ 48% 17.1M 5s
 86016K ........ ........ ........ ........ ........ ........ 50% 16.3M 5s
 89088K ........ ........ ........ ........ ........ ........ 52% 19.0M 5s
 92160K ........ ........ ........ ........ ........ ........ 53% 15.0M 5s
 95232K ........ ........ ........ ........ ........ ........ 55% 16.1M 4s
 98304K ........ ........ ........ ........ ........ ........ 57% 18.3M 4s
101376K ........ ........ ........ ........ ........ ........ 58% 13.3M 4s
104448K ........ ........ ........ ........ ........ ........ 60% 18.2M 4s
107520K ........ ........ ........ ........ ........ ........ 62% 16.7M 4s
110592K ........ ........ ........ ........ ........ ........ 64% 17.3M 4s
113664K ........ ........ ........ ........ ........ ........ 65% 12.5M 3s
116736K ........ ........ ........ ........ ........ ........ 67% 13.8M 3s
119808K ........ ........ ........ ........ ........ ........ 69% 14.7M 3s
122880K ........ ........ ........ ........ ........ ........ 71% 15.0M 3s
125952K ........ ........ ........ ........ ........ ........ 72% 17.8M 3s
129024K ........ ........ ........ ........ ........ ........ 74% 17.7M 3s
132096K ........ ........ ........ ........ ........ ........ 76% 16.5M 2s
135168K ........ ........ ........ ........ ........ ........ 78% 17.7M 2s
138240K ........ ........ ........ ........ ........ ........ 79% 13.2M 2s
141312K ........ ........ ........ ........ ........ ........ 81% 17.3M 2s
144384K ........ ........ ........ ........ ........ ........ 83% 19.8M 2s
147456K ........ ........ ........ ........ ........ ........ 84% 19.7M 2s
150528K ........ ........ ........ ........ ........ ........ 86% 14.7M 1s
153600K ........ ........ ........ ........ ........ ........ 88% 19.2M 1s
156672K ........ ........ ........ ........ ........ ........ 90% 13.6M 1s
159744K ........ ........ ........ ........ ........ ........ 91% 24.1M 1s
162816K ........ ........ ........ ........ ........ ........ 93% 13.4M 1s
165888K ........ ........ ........ ........ ........ ........ 95% 15.9M 0s
168960K ........ ........ ........ ........ ........ ........ 97% 20.6M 0s
172032K ........ ........ ........ ........ ........ ........ 98% 21.2M 0s
175104K ........ ........ ........ .......                   100% 22.8M=10s

2016-05-02 11:25:20 (16.9 MB/s) - ‘jdk-8u91-linux-x64.tar.gz’ saved [181367942/181367942]

Download done.
Removing outdated cached downloads...
sha256sum mismatch jdk-8u91-linux-x64.tar.gz
Oracle JDK 8 is NOT installed.
dpkg: error processing package oracle-java8-installer (--configure):
 subprocess installed post-installation script returned error exit status 1
Setting up gsfonts (1:8.11+urwcyr1.0.7~pre44-4.2ubuntu1) ...
Setting up x11-common (1:7.7+1ubuntu8.1) ...
dmesg: klogctl failed: Function not implemented
/bin/df: cannot read table of mounted file systems: No such file or directory
runlevel:/var/run/utmp: No such file or directory
invoke-rc.d: policy-rc.d denied execution of start.
Processing triggers for ureadahead (0.100.0-16) ...
Setting up xfonts-encodings (1:1.0.4-1ubuntu1) ...
Setting up xfonts-utils (1:7.7+1) ...
Setting up gsfonts-x11 (0.22) ...
Processing triggers for libc-bin (2.19-0ubuntu6.7) ...
Errors were encountered while processing:
 oracle-java8-installer
E: Sub-process /usr/bin/dpkg returned an error code (1)
user@mymachine:~$

About this issue

  • Original URL
  • State: closed
  • Created 11 years ago
  • Comments: 23 (5 by maintainers)

Most upvoted comments

Installing Oracle JDK Java SE Development Kit 8 x64 bits

Download Oracle JDK

wget --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u5-b13/jdk-8u5-linux-x64.tar.gz

Then…

sudo su

The /opt directory is reserved for all the software and add-on packages that are not part of the default installation. Create a directory for your JDK installation:

mkdir /opt/jdk

and extract java into the /opt/jdk directory:

tar -zxf jdk-8u5-linux-x64.tar.gz -C /opt/jdk

Verify that the file has been extracted into the /opt/jdk directory.

ls /opt/jdk

## Setting Oracle JDK as the default JVM In our case, the java executable is located under /opt/jdk/jdk1.8.0_05/bin/java . To set it as the default JVM in your machine run:

update-alternatives --install /usr/bin/java java /opt/jdk/jdk1.8.0_05/bin/java 100

and

update-alternatives --install /usr/bin/javac javac /opt/jdk/jdk1.8.0_05/bin/javac 100

Verify your installation Verify that java has been successfully configured by running:

update-alternatives --display java

Output should look like this:

java - auto mode
link currently points to /opt/jdk/jdk1.8.0_05/bin/java
/opt/jdk/jdk1.8.0_05/bin/java - priority 100
Current 'best' version is '/opt/jdk/jdk1.8.0_05/bin/java'.

and then run this

update-alternatives --display javac

Output should look like this:

javac - auto mode
link currently points to /opt/jdk/jdk1.8.0_05/bin/javac
/opt/jdk/jdk1.8.0_05/bin/javac - priority 100
Current 'best' version is '/opt/jdk/jdk1.8.0_05/bin/javac'.

And Finally!

java -version

Output should look like this:

java version "1.8.0_05"
Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)

image

We have done a lot of work to make certain Java is functional. Just ran through the following steps successfully on 14936.

user@mymachine:~$ sudo add-apt-repository ppa:webupd8team/java
user@mymachine:~$ sudo apt-get update
user@mymachine:~$ sudo apt-get install oracle-java8-installer

doing that installs:

user@mymachine:~$ java -version
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)

As for the packages available, updating to Xenial on 14396 is much more up-to-date.

Marking this one as fixed.

It seems somehow jdk package is not downloaded correctly.

try to use a better internet connection. first remove broken download

sudo rm /var/cache/oracle-jdk8-installer/jdk-8u91-linux-x64.tar.gz

and then reinstall it

@amadib I’ve created Issue #541 to address the java hanging (we’re seeing it across a range of java products)

For the short term, I have had luck with the instructions here: http://xubuntugeek.blogspot.com/2012/09/how-to-install-oracle-jdk-7-manually-in.html.

For the longer term, we have apt-get install default-jdk working on internal builds. The fix is inbound. Unfortunately no ETA on when it will hit the insider fast ring.