Opening JNLP files correctly in Firefox, specifically for Dell’s iDRAC interfaces

I recently reinstalled my desktop with Fedora 23, and found the need to “fix” the way Firefox launches files with .jnlp extensions.  In many cases it is merely sufficient to install the icedtea-web RPM package using:

$ sudo dnf install -y icedtea-web

However, as is the case with many java based applications, this is typically not sufficient. Particularly when looking at out of band management interfaces for various vendor hardware, e.g. Dell’s iDRAC interfaces are notoriously difficult to get working out of the box on Fedora based systems.

I recently stumbled on the following which got me about 99% of the way to having the iDRAC console links work correctly:

https://stuffivelearned.org/doku.php?id=apps:firefox:jnlpfix

Though I did find a small issue with the very last part of the instructions.  I’m including the content here (in the off chance that the link should go stale and I’d like to preserve the knowledge being shared). Content is somewhat abridged.

Open Your Profile’s Mimetypes File

 Typically this is under $HOME/.mozilla/firefox/<profile id>.default/ and is named mimeTypes.rdf
Stop firefox, and then save a copy of this file:
cp mimeTypes.rdf mimeTypes.rdf.save
Now edit the file mimeTypes.rdf using your favorite editor, and inside the section:
<RDF:Seq RDF:about=”urn:mimetypes:root”> add the following:
 <RDF:li RDF:resource="urn:mimetype:application/x-java-jnlp-file"/>
Following the </RDF:Seq> close, add the following:
  <RDF:Description RDF:about="urn:mimetype:application/x-java-jnlp-file"
                   NC:fileExtensions="jnlp"
                   NC:description=""
                   NC:value="application/x-java-jnlp-file"
                   NC:editable="true">
    <NC:handlerProp RDF:resource="urn:mimetype:handler:application/x-java-jnlp-file"/>
  </RDF:Description>

Below that, add this:

  <RDF:Description RDF:about="urn:mimetype:handler:application/x-java-jnlp-file"
                   NC:alwaysAsk="false"
                   NC:saveToDisk="false"
                   NC:useSystemDefault="false"
                   NC:handleInternal="false">
    <NC:externalApplication RDF:resource="urn:mimetype:externalApplication:application/x-java-jnlp-file"/>
  </RDF:Description>

Almost done, one more section to add:

<RDF:Description RDF:about="urn:mimetype:externalApplication:application/x-java-jnlp-file"
                   NC:path="/path/to/external/script"
                   NC:prettyName="some-name-here" />
</RDF:Description>

So in my case, I created an external script in my home directory which in turn calls javaws. The reason for this is that in the case of the Dell iDRAC interfaces, the .jnlp files have long filenames which include numerous characters which cause issues with the call to the external program.  For example, you may find the filename may look something like this:

/tmp/mozilla_kambiz0/viewer.jnlp\(some-idrac-fqdn-goes-here@0@idrac-1234567\,+PowerEdge+R620\,+User_+root@145519812345@ST1\=002f4511d94638eaaabbb80bb6642bda\)

So I ended up using the path: /home/kambiz/bin/Java-Web-Start (and the prettyName of “Java-Web-Start“).  Make the Java-Web-Start an executable script (mode 755) with the following content:

#!/bin/sh

tmpfile=`mktemp /tmp/javaXXXXXX.jnlp`
cp "$1" $tmpfile
javaws $tmpfile
rm -f $tmpfile

One last thing remains to do to ensure Java launches correctly:

cp .config/icedtea-web/security/trusted.certs ~/.java/deployment/security/
cp .config/icedtea-web/security/trusted.jssecacerts ~/.java/deployment/security/

That should do it!

Thanks Will Foster!