Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dynamically load additional jar files using Web Start / JNLP

The Web Start Developers Guide states

All application resources must be retrieved from the JAR files specified in the resources section of the JNLP file, or retrieved explicitly using an HTTP request to the Web server.

Storing resources in JAR files is recommended, since they will be cached on the local machine by Java Web Start.

Now, I have some resources I want to dynamically load after my application has been started (for example OSGi bundles). I can do this using plain HTTP, but I would like to make use of Web Start's support for local caching and versioned/architecture-specific resources.

Is there a way to download additional jar files from the original code base (as specified in the application's jnlp file) using the Web Start infrastructure?

Or alternatively: is there already an established way to integrate OSGi and Web Start that would relieve me of the task to install bundles from the Web Start server?

like image 302
Thilo Avatar asked Mar 18 '09 06:03

Thilo


2 Answers

If you make your application in itself an Equinox-based OSGI application, you can web-start it with all the addition bundles you need.

This article "WebStarting Equinox OSGi Apps" can give you a good introduction on the required settings.

  • All bundles have to be deployed as signed JAR files
  • You need a feature that contains all the necessary bundles
  • When exporting the feature, make sure that PDE creates a JNLP (Java Network Lauching Protocol) file (a checkbox in the export wizard) for this feature
  • Provide a root JNLP file for you application
  • Deploy your application to a web server and make sure that the web server is aware of the application/x-java-jnlp-file mime type

He also has an OSGI demo.

like image 121
VonC Avatar answered Oct 15 '22 20:10

VonC


I haven't tried it but look at the javax.jnlp.DownloadService API

like image 1
l_39217_l Avatar answered Oct 15 '22 18:10

l_39217_l