Johan's blog

Java Web Start and OSGi

Recently, I am working on a project where we use Java Web Start and OSGi technologies. For both technologies, you have believers and you have non-believers. As for many Java technologies, I became pragmatic in using them.

Java Web Start is really cool for distributing my application. I don't have numbers on this, but it seems that the installed base of Java Web Start (JWS) is peaking. Which is great. The "Web" in "Java Web Start" is misleading, though, since it has nothing to do with a web-framework. However, the word "Web" is important since JWS allows you to distribute your applications via the Web, by serving a JNLP-file. But that's basically all it has to do with the "Web" as most people know it. Or not, since I recently discovered a cool feature. My JNLP-served application needed to download jar-files from a http-password based web directory (as part of the OSGi solution). The cool thing is that I don't have to add code in my application for doing the authentication, you automatically get a nice box that allows you to authenticate yourself. 

The OSGi Framework is great for managing the lifecycle and dependencies between different modules that make up an application. OSGi defines the concept of Bundles and Services, see http://osgi.org/documents/collateral/OSGiTechnicalWhitePaper.pdf for some basic information. Using OSGi, you can develop an application in a very modular way, where third parties can develop modules that are based on your modules and vice versa. The old idea of separation between interface and implementation really happens in an OSGi environment. Applications that leverage the OSGi framework depend on pieces of code that can come from various sources. They ask the OSGi Framework for "an" implementation of a particular interface, and it is up to the Framework to provide the caller with the best matching implementation.

I am not religious about Java Web Start nor about OSGi. Both technologies have their merits and disadvantages. If you use them in a proper way, your applications can benefit from them. None of these technologies claim to solve all potential problems, and that is what I like: I don't believe there is a single framework/technology that fits for all scenario's.  


posted on Sunday 27 Jan 2008 at 22:05
Leave a comment
No comments