Associating JNLP files on Gnome 3

On Gnome 3, the support for mimetypes is more better than compared with old Gnome 2. Now we have a mimetype repository for all files types, where we can easily customize rules to manage apps per files, or files per apps (too!).

Java WEB (Java WEB Start) apps use JNLP or JSP files to open him on client browsers and desktops, the problem starts when we try to open these files on file explorer, they always open on our browsers (Chrome, Firefox, etc.) by default. To change this, we need to do few changes by terminal. Then, follow these steps:

Access the managed mimetypes folder:

[bash]cd /usr/share/applications[/bash]

Then, create a new file to associate your javaws command with JNLP files. This step requires sudo permission.

[bash]sudo vim /usr/share/applications/javaws.desktop[/bash]

Ok, now put this content in this file:

#!/usr/bin/env xdg-open

[Desktop Entry]

Name=Sun Java 7 Web Start
Comment=Sun Java 7 Web Start
Exec=/usr/lib/jvm/jdk1.7.0_65/bin/javaws %u

Pay attention to this line:

[bash]Exec=/usr/lib/jvm/jdk1.7.0_65/bin/javaws %u[/bash]

You’ll put the location of your javaws executable at JVM folder. On Ubuntu-based distros the installation folder always is at /usr/lib/jvm/.

Now, we need registry this new configuration for gnome mimetypes manager. To do this, do this:

[bash]sudo vim /usr/share/applications/defaults.list[/bash]

At the end of this file, put a new entry referring your previous file ‘javaws.desktop’, like this:


Save and close the file.

Now, you can test across browser or your favorite file explorer.