Differences between revisions 1 and 2
Revision 1 as of 2006-09-30 09:11:49
Size: 2783
Editor: p5086CBCF
Revision 2 as of 2009-09-20 22:58:43
Size: 2783
Editor: localhost
Comment: converted to 1.6 markup
No differences found!

First steps with Knopflerfish

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

Why Knopflerfish?

  • fancy desktop interface
  • eclipse plugin
  • many included bundles
  • some kind of convenient
  • seems to be quite active
  • there is some documentation

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 http://www.knopflerfish.org/tutorials/osgi_tutorial.pdf 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: http://oscar-osgi.sourceforge.net/tutorial/

The Eclipse Plugin

For the plugin you have to setup the preferences to define which framework you want to use: http://www.knopflerfish.org/eclipse_preferences.html

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

  • configure your bundle manifest
  • automatically build your bundle to the out/ directory
  • OSGi requires you to define the packages you want to use. The plugin sets the classpath accordingly, so you can't forget.
  • run/debug everything inside eclipse

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)