0 Replies Latest reply on Sep 27, 2013 9:33 AM by SeitzD

    search for updates during runtime


      While the jws application is running it should look for new updates. If there are any, it displays a message like "There is a new version. Please restart the application to download the latest update". The problem is I don't know how to look for an update of the jws application. I've tried to use DownloadService2 (JNLP API Examples) but failed.


      This code should check for new updates and gets called periodically:

      BasicService bs = (BasicService)ServiceManager.lookup("javax.jnlp.BasicService");
      System.out.println("Codebase: " + bs.getCodeBase());
      DownloadService2 service = (DownloadService2) ServiceManager.lookup("javax.jnlp.DownloadService2");
      ResourceSpec spec = new ResourceSpec(bs.getCodeBase()+".*", null, DownloadService2.JAR);
      ResourceSpec cacheResults[] = service.getCachedResources(spec);
      for (ResourceSpec resource : cacheResults) {
      ResourceSpec updateResults[] = service.getUpdateAvailableResources(spec);
      for (ResourceSpec resource : updateResults) {


      The jar and the jnlp are hosted on a webserver and downloaded from there. If anything has changed in the code I upload a new jar unto the server. But service.getUpdateAvailableResource(spec) doesn't find any updates.