Question

I have a jws based application.
It is being deployed on a web server and the client downloads the file from the browser and runs it.
This creates a desktop shortcut and the applications runs perfectly.

Now if I change some properties in the jnlp file on server and then run the installed application ( on client machine ) from desktop shortcut or from the downloaded jnlp file itself, it doesn't gets updated.

I have verified this on jdk version 1_6_30 and 1_7_21. These two releases seems to have resolved previous bug related to whitespaces in cache path.
Issue remains on Windows XP/7/8.

Original jnlp file :

<?xml version="1.0" encoding="UTF-8"?>
<jnlp codebase="path/to/fileLocation" spec="1.0+" href="demo.jnlp" >

<information>
 .
 .
 .
 <offline-allowed/>
  <shortcut online="false">
          <desktop/>
          <menu submenu="Demo"/>
  </shortcut>
</information>
<update check="always" policy="always"/>
<!--request all permissions from the application. This does not change-->
<security>
  <all-permissions/>
</security>
.
.
<resources>
<!-- Here we are referring to the wrapper feature since it transitively refers to all the other plug-ins  necessary -->
<extension> 
    name="Wrapper feature"
    href="plugin_<some_random_generated_string_1>.jnlp"/>
</extension>
</resources>
.
.
.
<resources os="Windows" arch="x86">
         <j2se version="1.6+"  java-vm-args="-Xms400m -Xmx800m"/>
</resources>

Updated jnlp file :

<?xml version="1.0" encoding="UTF-8"?>
<jnlp codebase="path/to/fileLocation" spec="1.0+" href="demo.jnlp" >

<information>
 .
 .
 .
 <offline-allowed/>
  <shortcut online="false">
          <desktop/>
          <menu submenu="Demo"/>
  </shortcut>
</information>
<update check="always" policy="always"/>
<!--request all permissions from the application. This does not change-->
<security>
  <all-permissions/>
</security>
.
.
<resources>
<!-- Here we are referring to the wrapper feature since it transitively refers to all the other plug-ins  necessary -->
<extension> 
    name="Wrapper feature"
    href="plugin_<some_random_generated_string_2>.jnlp"/>
</extension>
</resources>
.
.
<resources os="Windows" arch="x86">
          <j2se version="1.6+"  java-vm-args="-Xms300m -Xmx600m"/>
</resources>

Change in java-vm-args does not gets reflected.
Update works if I re-download the jnlp file and then run from it. In this case the desktop shortcut still refers to the old one which is a pain :(

Verified the jnlp using JaNeLa.

EDIT:

This demo.jnlp also includes another feature jnlp (added in the blockquotes) which includes all the required jars for the application. Since on every update of the application this feature jnlp also gets updated but the same is not reflected on the client.

Was it helpful?

Solution

JWS has always been good at updating Jars, but ..less so when updating the JNLP files themselves. A dynamically generated JNLP would typically lack an href attribute to indicate to the Plug-In not to create a desktop shortcut.

On the other hand a work-around might be found in the IntegrationService of the JNLP API. You might:

  1. Cache a copy of the last known JNLP in the PersistenceService.
  2. At app. start-up, connect back to the server and explicitly read the JNLP.
  3. Compare it to the cached version.
  4. If changed, uninstall the desktop shortcut & relaunch the app.
  5. If not changed, and no desktop shortcut exists, prompt to install (new) desktop shortcut.

Steps 2 & 3 might be replaced by a simple check of the headers for the URL connection for the JNLP, if the server returns a valid 'last updated' time.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top