How to make java web start launch automatically without double click on the JNLP

ManKeer picture ManKeer · Apr 4, 2016 · Viewed 58.1k times · Source

I have a java applet application which is accessed by our customers through our website. Since Microsoft edge and chrome stopped supporting java plug in, we converted the applet to be launched through JNLP and Java Web Start, Unfortunately, In both browsers the JNLP downloaded and the customer should double click the file in order to launch a Java Web Start.

Our customers totally disappointed from this behavior, And I'm trying to find a solution for this issue.

Answer

SubOptimal picture SubOptimal · Apr 4, 2016

Possible solutions

1) Change the behavior in the browser to ask the user what to do when he click on a JNLP link. Then the user can select Open with: Java web start launcher or save file.

edit It's working in Firefox but it doesn't work with Chrome: see related bug reports 10877 and the open issues

2) Provide a script to the user which executes
javaws https://example.com/your_application.jnlp

An example for demonstration (application link taken from Oracle tutorial: Running a Java Web Start Application)

javaws https://docs.oracle.com/javase/tutorialJWS/samples/deployment/NotepadJWSProject/Notepad.jnlp

This will open a simple Java application.

edit For the fearless there is a hacky solution for Chrome.

  1. close Chrome, and keep in mind to always make a copy of the files altered in the next steps ;-)
  2. find in the Chrome library chrome.[so|dll] the bytes jnlp and patch them as e.g. jnl-
  3. find in your Chrome user profile directory the file Preferences and amend it as ...

.

"download": {
    ...
    "extensions_to_open": "jnlp",
    ...
},

Next time you click on a link to a JNLP file it will be opened automatically (with the application which is assigned to open this file type, normally it's javaws).

The property was found after having a look into the source pref_names.cc. But Chrome treat the extension jnlp as dangerous that's why we need to patch the library as well.