5

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
  • Please add output of update-java-alternatives -l and which javaws to the question. – N0rbert Apr 18 '19 at 17:40
  • To get faster response please share ProRealTime jnlp file (or link to it). – N0rbert Apr 25 '19 at 10:30
  • @N0rbert the link to the jnlp is not known, you need to create a free account and press the launcher button in the website: prorealtime.com/en/workstation – Roman Rdgz Apr 25 '19 at 10:40
  • I'll test your JNLP file on real hardware soon. It does not work on VirtualBox with Ubuntu MATE 18.04.2 LTS. The positive result is that it works on Ubuntu MATE 16.04.6 LTS with OpenJDK 8. – N0rbert Apr 25 '19 at 15:31
  • I have tested method for 18.04 - see edited answer below. – N0rbert Apr 26 '19 at 17:33
5
+100

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://mirrors.kernel.org/ubuntu/pool/main/o/openjdk-8/openjdk-8-jre-headless_8u222-b10-1ubuntu1~16.04.1_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://mirrors.kernel.org/ubuntu/pool/main/o/openjdk-8/openjdk-8-jre_8u222-b10-1ubuntu1~16.04.1_amd64.deb
sudo apt install -y ./openjdk-8-jre_8u222-b10-1ubuntu1~16.04.1_amd64.deb

wget http://mirrors.kernel.org/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://mirrors.kernel.org/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 8u222-b10-1ubuntu1~16.04.1
Pin-Priority: 1337

Package: openjdk-8-jre-headless
Pin: version 8u222-b10-1ubuntu1~16.04.1
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.

| improve this answer | |
  • Did this, and the JNLP you proposed works. Nevertheless, I then try to run other application from Firefox (in this case ProRealTime, but I also tried other online jnlp applications used as test according to IcedTea documentation, and they don't work. See my question edit – Roman Rdgz Apr 19 '19 at 12:09
  • I will test the new approach. I still think that the problem is originated by the usage of Java 11, and this is avoided by your method. Thanks – Roman Rdgz Apr 26 '19 at 19:08
  • 1
    @JohnMudd links are fixed, thank you! Also please note that this method was created specially for running JNLP and may not suit your needs. – N0rbert Jul 23 '19 at 9:59
  • wget mirrors.kernel.org/ubuntu/pool/main/o/openjdk-8/… is broken. – Andrew Fount Aug 19 '19 at 20:33
  • 1
    I've got Error: Unable to use Firefox's proxy settings. Using "DIRECT" as proxy type. Codebase matches codebase manifest attribute, and application is signed. Continuing. See: docs.oracle.com/javase/7/docs/technotes/guides/jweb/security/… for details. – Andrew Fount Aug 20 '19 at 20:14
2

On my system I found that javaws was still trying to use jre-11 (which didn't work), because the default-jre-headless (a dependency of icedtea-netx) created a link (that was not being modified by update-java-alternatives).

$ javaws
selected jre: /usr/lib/jvm/default-java

I had to manually change that symbolic to point to the jre-8 version in order to have javaws running again.

| improve this answer | |
1

I was able to set default java-8 or java-11.


$ sudo update-java-alternatives --jre --set java-1.8.0-openjdk-amd64
$ sudo update-java-alternatives --jre-headless --set java-1.8.0-openjdk-amd64
$ sudo update-java-alternatives --set java-1.8.0-openjdk-amd64
update-alternatives: error: no alternatives for appletviewer
update-alternatives: error: no alternatives for mozilla-javaplugin.so
update-java-alternatives: jdk alternative does not exist: /usr/lib/jvm/java-8-openjdk-amd64/bin/appletviewer
update-java-alternatives: jdk alternative does not exist: /usr/lib/jvm/java-8-openjdk-amd64/bin/jconsole
update-java-alternatives: plugin alternative does not exist: /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/IcedTeaPlugin.so

$ sudo update-java-alternatives --jre --set java-1.11.0-openjdk-amd64
$ sudo update-java-alternatives --jre-headless --set java-1.11.0-openjdk-amd64
$ sudo update-java-alternatives --set java-1.11.0-openjdk-amd64
update-alternatives: error: no alternatives for appletviewer
update-alternatives: error: no alternatives for mozilla-javaplugin.so

and then properly set variable JAVA_HOME by one of commands


$ export JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:bin/java::")
$ export JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:jre/bin/java::")
$ echo $JAVA_HOME

It is worth to check the variable value.

When running


 $ javaws filename.jnpl

I have got some warning and response including

netx: Invalid jnlp file /home/phobos/express.jnpl

The express.jnpl is the ARIS express modelling tool from https://www.ariscommunity.com/aris-express/download

The respective responses are


$ javaws ~/express.jnpl
selected jre: /usr/lib/jvm/java-8-openjdk-amd64/jre/

(java:11196): dbind-WARNING **: 19:40:56.468: Couldn't register with accessibility bus: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.
netx: Invalid jnlp file /home/phobos/express.jnpl

$ javaws ~/express.jnpl
selected jre: /usr/lib/jvm/java-11-openjdk-amd64/
WARNING: package javax.jnlp not in java.desktop
netx: Invalid jnlp file /home/phobos/express.jnpl

Now it remains to find out whats wrong eithwer with jnpl file, or with my configuration.

SOLVED - I used wrong file name. It is working now.


$ javaws ~/express.jnlp
selected jre: /usr/lib/jvm/java-8-openjdk-amd64/jre/
selected jre: /usr/lib/jvm/java-8-openjdk-amd64/jre/
Codebase matches codebase manifest attribute, and application is signed. Continuing. See: http://docs.oracle.com/javase/7/docs/technotes/guides/jweb/security/no_redeploy.html for details.
Starting application [com.idsscheer.aris.expresslauncher.AExpressLauncher] ...
May 02, 2019 6:36:28 PM com.idsscheer.aris.common.ADebug println
INFO: [config] creating plugin.cfg from jar file

Running ok with current version 8u212. It remains to make JAVA_HOME name change permanent.

| improve this answer | |
1

It has obviously to do with reference to Oracle. I uninstalled Oracle java long time ago. (I did not find the solution, yet.) I am on Ubuntu 19.04 using Unity.

See following, specifically "selected jre"

$ 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

$ java -version

openjdk version "11.0.3" 2019-04-16
OpenJDK Runtime Environment (build 11.0.3+7-Ubuntu-1ubuntu1)
OpenJDK 64-Bit Server VM (build 11.0.3+7-Ubuntu-1ubuntu1, mixed mode, sharing)

$ which javaws    
/usr/bin/javaws

$ javaws    
selected jre: /usr/lib/jvm/java-8-oracle

thread 'main' panicked at 'Error spawning JVM process, java executable: [/usr/lib/jvm/java-8-oracle], arguments: [["-splash:/usr/share/icedtea-web/javaws_splash.png", "-Xbootclasspath/a:/usr/share/icedtea-web/javaws.jar:/usr/share/java/js.jar:/usr/share/java/tagsoup.jar:/usr/lib/jvm/java-8-oracle/lib/ext/nashorn.jar:", "-classpath", "/usr/lib/jvm/java-8-oracle/lib/rt.jar:/usr/lib/jvm/java-8-oracle/lib/ext/jfxrt.jar:", "-Dicedtea-web.bin.name=javaws", "-Dicedtea-web.bin.location=/usr/lib/icedtea-web/bin/javaws", "net.sourceforge.jnlp.runtime.Boot"]]', src/os_access.rs:36:19
note: Run with `RUST_BACKTRACE=1` for a backtrace
| improve this answer | |
1

I found that an old Oracle installation had continued to leave environment variables set:

% env | grep oracle
JAVA_HOME=/usr/lib/jvm/java-8-oracle
J2REDIR=/usr/lib/jvm/java-8-oracle/jre
DERBY_HOME=/usr/lib/jvm/java-8-oracle/db
J2SDKDIR=/usr/lib/jvm/java-8-oracle

unsetting those made javaws pick up the non-Oracle JRE.

| improve this answer | |
  • To expand on this, in my case the environment variables were set by scripts in /etc/profile.d (there was jdk.sh and jdk.csh, substantially identical). Removing these fixed the problem permanently. – cooperised Apr 16 at 15:48
0

I fixed this by setting the jdk8 directory in icedtea control panel. I opened the control panel, went to JVM settings and filled the field with:

/usr/lib/jvm/java-8-openjdk-amd64

I am running Ubuntu 18.04, and have both jdk11 and jdk8 installed. Normally, java-default is linked to jdk11 so icedtea will crash due to some classes being removed.

| 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.