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

63,130

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.

Share:
63,130
ManKeer
Author by

ManKeer

Currently, I have about 8 to 9 years of experience in writing code, I love C++ and Java, At this moment I like to develope websites so I start learning HTML5, Javascript, CSS, Python and Ruby. Also I have wrote many files using vbscript, shell scripts and batch for diffenet type of tasks especially those who deals with AD and Unix. My experience are too wide, I worked in the signal processing and image processing algorithms, I wrote code for diffenet mobile applications, and now I'm writing code for stock markets. I'm in love with programming and Ilike to learn everyday in engineering and programming as well.

Updated on April 05, 2020

Comments

  • ManKeer
    ManKeer about 4 years

    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.

  • ManKeer
    ManKeer about 8 years
    how can I apply the first point, regarding the example you have mentioned, it's not working from oracle website. moreover, I'm looking for running the Jave Web Start directly, I don't need the customer to see any change, just click on the link and everything will run exactly as he/she run an applet.
  • SubOptimal
    SubOptimal about 8 years
    @ManKeer Sorry my fault. Did not pay enough attention for the browsers in question. I amend my answer at least for Chrome. For Microsoft Edge I can't help, don't have it.
  • SubOptimal
    SubOptimal about 8 years
    @ManKeer Not a real solution for your customers, but maybe you are anyway interested. Have a look to the "hacky solution" in my answer.
  • ManKeer
    ManKeer about 8 years
    Thank you very much for your cooperation, but as you said this is totally not a solution for my customers. but really I appreciate your effort for helping
  • ManKeer
    ManKeer about 8 years
    How to extract the bytes of the chrome.dll
  • SubOptimal
    SubOptimal about 8 years
    @ManKeer I did it manually using a binary(aka. hex)-editor.
  • Fernando Pie
    Fernando Pie over 5 years
    Sorry I have nor try this solution. But is is the most practical, real solution, with actual version of chrome? Thanks in advance.