Ubuntu – IcedTea-8 cannot run any jnlp application (maybe due to openjdk-11?)

aptjavaopenjdk

I'm on Ubuntu MATE 18.04. All the jnlp applications I tried give execution error. After inspection, some libraries seem to be missing in Java.

So I removed everything, started installation again, and found that apt-get install icedtea-8-plugin depends on:

  ca-certificates-java default-jre default-jre-headless icedtea-8-plugin
  icedtea-netx librhino-java libtagsoup-java openjdk-11-jre
  openjdk-11-jre-headless

While it is expected to depend on openjdk-8, not 11 (according to ubuntu packages website). I suspect that jdk-11 does not include some libraries required for this.

My guess is that I installed some PPA that now produces this situation where jdk-11 is a more up to date choice than any jdk-8 package. So, how can I achieve that icedtea-8 is installed with openjdk-8, and not 11?

EDIT:
This is the output when I try to launch from firefox a jnlp application:

Denying permission: ("java.lang.RuntimePermission" "accessClassInPackage.sun.util.resources")
net.sourceforge.jnlp.LaunchException: Fatal: Launch Error: Could not launch JNLP file. The application has not been initialized, for more information execute javaws/browser from the command line and send a bug report.     at net.sourceforge.jnlp.Launcher.launchApplication(Launcher.java:582)
...
Running jdk9+ ?
java.lang.ClassNotFoundException: sun/misc/JarIndex
...
java.io.FileNotFoundException: /home/roman/.config/icedtea-web/deployment.properties (No existe el archivo o el directorio)     at java.base/java.io.FileInputStream.open0(Native Method)

The ClassNotFoundException: sun/misc/JarIndex is what made me thought that is due to the dependency on jdk11, since this class seems to have been removed in Java 9.

I tried installing only openjdk-8, and then build icedtea from source. Nevertheless, when I finished, it was not detected by firefox (maybe some command was missing).

Any idea?

Also, find below the output of those commands (after trying installing according to your answer):

roman@roman-desktop:~$ update-java-alternatives -l
java-1.11.0-openjdk-amd64      1111       /usr/lib/jvm/java-1.11.0-openjdk-amd64
java-1.8.0-openjdk-amd64       1081       /usr/lib/jvm/java-1.8.0-openjdk-amd64
roman@roman-desktop:~$ which javaws
/usr/bin/javaws

Best Answer

After some trial and error I found only one useful solution - we need to install normal OpenJDK 8 from previous Ubuntu 16.04 LTS manually with commands below. It is usually not recommended, but we do not have other methods with positive result.

So the commands to install are the following (we remove existing OpenJDK and then install deb-packages manually):

sudo apt purge oracle-java11-* -y
sudo apt purge *openjdk* -y
sudo apt autoremove --purge -y

wget http://archive.ubuntu.com/ubuntu/pool/main/o/openjdk-8/openjdk-8-jre-headless_8u272-b10-0ubuntu1~16.04_amd64.deb
sudo apt install -y ./openjdk-8-jre-headless_8u222-b10-1ubuntu1~16.04.1_amd64.deb

wget http://security.ubuntu.com/ubuntu/pool/main/libp/libpng/libpng12-0_1.2.54-1ubuntu1.1_amd64.deb
sudo apt install -y ./libpng12-0_1.2.54-1ubuntu1.1_amd64.deb

wget http://archive.ubuntu.com/ubuntu/pool/main/o/openjdk-8/openjdk-8-jre_8u272-b10-0ubuntu1~16.04_amd64.deb
sudo apt install -y ./openjdk-8-jre_8u222-b10-1ubuntu1~16.04.1_amd64.deb

wget http://archive.ubuntu.com/ubuntu/pool/universe/i/icedtea-web/icedtea-netx-common_1.6.2-3ubuntu1_all.deb
sudo apt install -y ./icedtea-netx-common_1.6.2-3ubuntu1_all.deb

wget http://archive.ubuntu.com/ubuntu/pool/universe/i/icedtea-web/icedtea-netx_1.6.2-3ubuntu1_amd64.deb
sudo apt install -y ./icedtea-netx_1.6.2-3ubuntu1_amd64.deb

Also we need to pin/hold the versions of such packages with single long command below:

cat <<EOF | sudo tee /etc/apt/preferences.d/pin-java8
Package: icedtea-netx
Pin: version 1.6.2-3ubuntu1
Pin-Priority: 1337

Package: icedtea-netx-common
Pin: version 1.6.2-3ubuntu1
Pin-Priority: 1337

Package: openjdk-8-jre
Pin: version 8u272-b10-0ubuntu1~16.04
Pin-Priority: 1337

Package: openjdk-8-jre-headless
Pin: version 8u272-b10-0ubuntu1~16.04
Pin-Priority: 1337

EOF

and then the application will run with

javaws StartProRealTime.jnlp

Notes: the installation of Oracle Java 11 or 12 does not help either.