Feb 23
2010

OSGi Development with Knopflerfish – Part 1: The Setup

Written by Robert Greiner | posted in Programming, Tutorials | View Comments

The OSGi framework allows Java developers to create a dynamic component model for their applications. Developers create “bundles” that can be deployed and executed remotely and provide distributed services. The OSGi Framework can act as a which is not currently available with a vanilla JavaVM environment.

This tutorial will get you set up to create OSGi framework applications with Java. We will be using the Eclipse IDE and the OSGi plug-in to create our bundles as well as the Knopflerfish framework to host and execute them.

If you want to know more about Java modularity, be sure to check out Alex Blewitt’s articles on InfoQ.

InfoQ – Modular Java: What is it?
InfoQ – Modular Java: Static Modularity

Installing Eclipse

Eclipse can be downloaded here. I went with the “Eclipse IDE for java Developers” package but it doesn’t really matter which one you choose.

(Windows) Simply extract the downloaded zip file and run eclipse.exe to get started.

Installing the Eclipse OSGi Plugin

Next we’ll install the OSGi plug-in for Eclipse which will make creating bundles much easier, remove the need for using ant, and give us all of the benefits of using the Eclipse IDE to write code (intelli-sense, project management, code generation, etc.)

In Eclipse click Help -> Install New Software
Next, click the “Add” button and add the Knopflerfish update site: http://www.knopflerfish.org/eclipse-update/

Once the update site has been added, you should automatically see an option for the Knopflerfish plugin. Check the box and hit “Next” to install. Read the license terms and complete the installation.

Now, we can create OSGi Projects (More on that later)

Installing Knopflerfish

Download the latest stable release from the Knopflerfish website. I will be using the complete framework version 2.3.3 for this tutorial.

Now, we need to install the Knopflerfish framework:

java –jar knopflerfish_osgi_.jar

This will open up an installation wizard which will let you set an installation directory.

Finally, we need to run Knopflerfish:

java –jar framework.jar

You should now see the Knopflerfish OSGi Desktop. This is where we will register our bundles and execute them.

Now we’re finally ready to write our first bundle, time to move on to Part 2.

This is Part 3 of a 3 part introduction to OSGi and Knopflerfish.
SOA OSGi Development with Knopflerfish – Part 1: The Setup
SOA OSGi Development with Knopflerfish – Part 2: The Code
SOA OSGi Development with Knopflerfish – Part 3: The Execution

View Comments

  1. air jordan 8 says:

    The post of content is very interesting and exciting. I learned a lot from here.The content from simple to complex, air jordan 8 so all of you can come in .ugg boots for sale No matter you want to see what can be found.By the way ,there are some websites is also very wonderful,you can go and see.such asair force 1 shoes

blog comments powered by Disqus
  • Could not connect to Twitter
.NET Algorithmic Art ASP ASP .NET ASP .NET MVC audio Bill Gates C# code review Computational Art CouchDB CSS Database DateTime debug DevDays eclipse ethics FileSystem Git Improvement iPhone Java JQuery Knopflerfish Layouts mail Microsoft Oracle OSGi Processing Python Ruby SMTP SOA Software Piracy Source Control SQL StackOverflow tools TortoiseGit training Web Standards Windows XHTML