11

My actual version of java is

$ java -version
java version "1.6.0_38"
Java(TM) SE Runtime Environment (build 1.6.0_38-b05)
Java HotSpot(TM) 64-Bit Server VM (build 20.13-b02, mixed mode)

and it possible to run jnlp file as

$ javaws ContestAppletProd.jnlp

(it's TopCoder Contest Arena)

but I want to run it with simple double click.

When I do right click on file, there is "Open with Other Application" option, but I do not know how to add javaws here.

Betlista
  • 411
  • 2
  • 4
  • 11

2 Answers2

16

You will need to create a .desktop file like described in the this post for javaws to appear in Open With dialog.

In your case you will need to create a new text file in the folder ~/.local/share/applications. Name this file whatever you want, it has to have the extension .desktop. The content of this file has to be the following:

[Desktop Entry]
Encoding=UTF-8
Name=Java 6 Web Start
Comment=Java 6 Web Start
Exec=/usr/lib/jvm/java-6-oracle/jre/bin/javaws %u
Terminal=false
Type=Application
Icon=javaws
Categories=Application;Network;
MimeType=application/x-java-jnlp-file;

Please pay attention that the path to javaws executable in the Exec parameter may be different on your system. You can find out the path to your javaws executable by typing the following command in terminal:

which javaws

or by listing all your JDK/JRE installations with the command:

update-alternatives --display javaws
Kevin Bowen
  • 19,615
  • 55
  • 79
  • 83
bender
  • 1,814
0

As an addendum to bender's answer, if you are using Chrome you may not get a chance to change the default application without first going through the file manager's "Open With other Application" step. In my case (Chrome on XUbuntu 15.10 - XFCE), I had to:

  1. Let Chrome (or whatever browser) save the JNLP file
  2. Right click on it in the file manager, select "open with other application", choose application and check "Always use this".

There was already a correct jnlp application option in /usr/share/applications (multiple, in fact), so I didn't need to create my own, but it was not used until I did the above (JNLP files were associated with Firefox which didn't know what to do with them)

This is so basic that I couldn't figure it out for a while :)

akom
  • 131
  • 5