Java Webstart NixOS 18.09

How do I run a JNLP on NixOS 18.09? It requires at least Oracle JDK8 and the open-source icetea version has never worked for this particular application.

If you don’t need it to run from the browser, but are okay with running from the command line, you can install jre8Plugin:

$ nix-build -A pkgs.jre8Plugin
/nix/store/x8zjh5fhnim1swwvxq5rfm7bkchpiwr0-oraclejre-8u181

$ ./result/bin/javaws -version
Java(TM) Web Start 11.181.2.13-fcs 
Usage:  javaws [run-options] <jnlp-file>
        javaws [control-options]

What if I do want it to run from a browser?

Googling for nixpkgs firefox jre plugin turns up a topic here that looks like exactly what you’re after: Old Firefox with fresh Java plugin. (See also issue #25710 on github.)

Is this supposed to work just like that? I get an error about missing .nix file

You have to run that command from within a clone of the nixpkgs repo.

You could also do nix-shell -p jre8Plugin without cloning nixpkgs; inside that shell you can just run javaws directly.

When I run that command, I get the message:

error: Package ‘oraclejre-with-plugin-8u281’ in /nix/var/nix/profiles/per-user/root/channels/nixos/pkgs/development/compilers/oraclejdk/jdk-linux-base.nix:70 has an unfree license (‘unfree’), refusing to evaluate.

, but I already have that in my configuration.nix

  nixpkgs.config.allowUnfree = true;

However, running the command like this

NIXPKGS_ALLOW_UNFREE=1 nix-shell -p jre8Plugin

…gives me this:

error: builder for '/nix/store/wpf9djg9f3zq53nlymivvn7331jfas9a-jdk-8u281-linux-x64.tar.gz.drv' failed with exit code 1;
       last 10 log lines:
       > ***
       > Unfortunately, we cannot download file jdk-8u281-linux-x64.tar.gz automatically.
       > Please go to http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html to download it yourself, and add it to the Nix store
       > using either
       >   nix-store --add-fixed sha256 jdk-8u281-linux-x64.tar.gz
       > or
       >   nix-prefetch-url --type sha256 file:///path/to/jdk-8u281-linux-x64.tar.gz
       >
       > ***
       >
       For full logs, run 'nix log /nix/store/wpf9djg9f3zq53nlymivvn7331jfas9a-jdk-8u281-linux-x64.tar.gz.drv'.
error: 1 dependencies of derivation '/nix/store/ykp5hlwkv1gxgqk06i682f6bx7asckaz-oraclejre-with-plugin-8u281.drv' failed to build

Okay. Are you able to download jdk-8u281-linux-x64.tar.gz from that URL?

If this is such a manual process, I’m inclined to believe that I’m doing something wrong.

I just want to run JNLP files and this is not something which is deprecated, to my understanding?

I’m using ConnectWise ScreenConnect, which is the same thing as TeamViewer.

Also, jdk-8u281 is not the latest on that page; jdk-8u341 is.

This doesn’t seem any more manual than using any other restricted-license software via nix. I don’t think this is deprecated.

You’re right that 8u281 is not the latest, and indeed it doesn’t seem to be easy to find that download or Oracle’s site (probably intentionally, they want everyone using the latest patch version).

Anyway, if you want to pursue this, you can start by looking at the part of pkgs/top-level/all-packages.nix that defines jre8Plugin:

  jrePlugin = jre8Plugin;

  jre8Plugin = lowPrio (oraclejdk8distro false true);

  jdkdistro = oraclejdk8distro;

  oraclejdk8distro = installjdk: pluginSupport:
    (callPackage ../development/compilers/oraclejdk/jdk8-linux.nix {
      inherit installjdk pluginSupport;
    });

Then you can take a look at the history of jdk8-linux.nix to see what kind of update you’d need to make to get it up to a current version. The last two were:

right, but to get javaws, I have to use this restricted software? Ain’t javaws implemented in some free software package?

IcedTea is a build and integration project for OpenJDK launched by Red Hat in June 2007.[3] IcedTea also includes some addon libraries: IcedTea-Web is a free software implementation of Java Web Start and the Java web browser applet plugin.

So, basically, I need IcedTea-Web, then, instead?

EDIT: Hmm, guess not:

Java Web Start (JWS) was deprecated in Java 9, and starting with Java 11, Oracle removed JWS from their JDK distributions. This means that clients that have the latest version of Java installed can no longer use JWS-based applications. And since public support of Java 8 has ended in Q2/2019, companies no longer get any updates and security fixes for Java Web Start.

This is why we decided to create OpenWebStart, an open source reimplementation of the Java Web Start technology. Our replacement provides the most commonly used features of Java Web Start and the JNLP standard, so that your customers can continue using applications based on Java Web Start and JNLP without any change.

EDIT2: Ok, I solved it;)

nix shell nixpkgs#{adoptopenjdk-icedtea-web,javaPackages.openjfx17}

Running javaws from there and it’s all honky dory;)

1 Like