Thursday, April 12, 2012

Crawling to Run

In the previous post I explained how I needed jpm (Just Another Package Manager) so that I could install commands and services on a freshly minted EC2 instance. That works now fine and I am very excited about this.

The next step is to get my OSGi framework running. However, jpm is very consciously kept unrelated to OSGi, there are no dependencies except some metadata reuse since I do not have the time nor inclination to reinvent well defined applicable metadata. That said, jpm is about standard off the shelf nothing special JARs. Its only purpose is to make any JAR with a Main-Class header run on any operating system in the world without forcing the developer to learn how install services and commands for each operating system.

So if jpm is agnostic of OSGi, how do I get my framework running as an OS service or command?

Last year EclipseCon Karl Pauls was nagging me for a function in bnd to create an executable out of a bnd or bndrun file. In bnd(tools), you can launch a bndrun file so in principle it is possible to create a single JAR that you can then run from the command line with java -jar x.jar command. I started and as too many things it moved too soon to the background for anything useful to come out of it. However, it is also slightly different when you need it yourself, and I need this now. So this week I perfected the bnd package command. If you can develop a framework application in bnd(tools) then you can now turn it into an executable jar (once this bnd will hit the streets of course).

Once you have this executable JAR, jpm can then be used to installed it as a command or a service. I created a short video that demonstrates how I plan to make this all work:

This starts to look pretty promising (nothing was faked). The video was only edited to protect my thick slow fingers that try to get used to my new keyboard. However, don't start using it yet because it needs some chore work industrializing it (only used this on MacOS yet) and I need the freedom to make significant changes. Anyway, feedback appreciated and anybody that wants to spent some serious effort (test cases, windows) on this is welcome to contact me.

Peter Kriens


  1. Hi Peter,
    I saw that the jpm byte code is hosted on dropbox. I don't have access to dropbox at work, once a get home I will give a try on windows and let you know about the results.

  2. @Bruno: please note that the urls are not going to stay. The blogs are about ideas for the moment, not maintained open source programs. Things will change.

  3. This is very useful indeed. I am not particulary interested in jpm part of this, but I would love to use package command. It would simplify deployment a lot.
    So where can I find bnd with package command implemented? I would start using it right away on Windows and Linux.
    Could you please post a URL here?

  4. This is currently in the next branch on github.

    1. OK, I've build the bmd from the branch and it runs, but I get the following:
      000:;version=[1.4.2,1.4.3) Not found in [bnd-cache]
      001:;version=[1.4.1,1.4.2) Not found in [bnd-cache]
      002: org.apache.felix.log;version=[1.0.1,1.0.2) Not found in [bnd-cache]
      003: osgi.cmpn;version=[4.2.1,4.2.2) Not found in [bnd-cache]
      004: org.apache.felix.scr;version=[1.6.0,1.6.1) Not found in [bnd-cache]
      005: OdaLib;version=[1.5.0,1.5.1) Not found in [bnd-cache]
      006: org.knopflerfish.bundle.xerces;version=[2.10.1,2.10.2) Not found in [bnd-cache]
      007: org.jboss.netty;version=[3.4.5,3.4.6) Not found in [bnd-cache]
      008: Cannot launch because has reported org.apache.felix.framework;version=[4.0.1,4.0.1] Not found in [bnd-cache]
      000: No version set, uses 0.0.0

      It seems it can't find any of the bundles which are in the list of required bundles (it does not complain about bundles I'm actually developing). Jar contains only my bundles and none of the required.

      What am I missing here?


  5. Can you mail me directly?

  6. The project is built here: