First steps with Knopflerfish

It's a bit easier to discuss things when you know your enemy, so I tried out Knopflerfish.

Why Knopflerfish?

So this is not a vote against Felix. I'm quite convinced that James should ship with Felix when we would move to OSGi. But for first development Knopflerfish seems to be an easier starting point. And an OSGi compliant app should run in both.

Following A Tutorial

I downloaded the full-distro and followed the following tutorial using the eclipse plugin in parallel. The learning-curve was really flat and it didn't took much time to get the first examples running. This tutorial seems to be quite useful too:

The Eclipse Plugin

For the plugin you have to setup the preferences to define which framework you want to use:

Sometimes the plugin has some edges and is a bit tricky but it is all in all very useful. It lets you:

You can add additional bundles to your eclipse run configuration to have access to a console or even the desktop. One problem I ran into was adding xml files to the bundle. It is configured to only include .java/.class by default.

1. in Project/Proterties/Java Build Path/Source: Indluded **/*.xml 2. you have to manually edit .bundle-pack

<?xml version="1.0" encoding="UTF-8"?>
<resource dst="" pattern=".*\.xml|.*\.class" src="/fms_mailgenerator/out" type="0"/>

Adding an additional <resource> tag didn't work, it was ignored.

Knopflerfish Desktop

Using the Knopflerfish Desktop is great when you want to try out starting/stopping/install/update/remove bundles. Using the mouse is really convenient here and it is as easy as running inside eclipse if you don't need debugging.

Once you started Knopflerfish by something like java -jar framework.jar you can simply add your just created bundles from workspace/your-bundle/out/your-bundle-1.0.0.jar and play around with starting and stopping. And when you have changed something in eclipse you simply press the "Update Bundle" because the bundle in out/ is always up-to-date!

Now try on your own! :-)


Development/ReplacePhoenix/OSGi/KnopflerfishTryOut (last edited 2009-09-20 22:58:43 by localhost)