Using System.out in Osgi?

252 Views Asked by At

I am using bndtools and trying to get a "Hello World" running. How do I use jdk functionality?

The bndtools website only explains how to export an API, which is nice and all, but somehow I need to use jdk functionality in order to program anything, right? Like System.out. Or java.io.

lb shows this:

g! lb
START LEVEL 1
   ID|State      |Level|Name
    0|Active     |    0|System Bundle (4.2.1)
    1|Active     |    1|Apache Felix Gogo Runtime (0.10.0)
    2|Active     |    1|Apache Felix Gogo Shell (0.10.0)
    3|Active     |    1|Apache Felix Gogo Command (0.12.0)
1

There are 1 best solutions below

3
On

The tutorial does NOT only explain how to export an API. If you keep reading it also shows how to import that API in another bundle and use it. Specifically, Section 4 details how to create an implementation project, i.e. a project that creates a component that runs and does something.

So you can skip the stuff about exporting and importing (though you'll need to come back to it later) and create just a plain component with an activate method. From that activate method you can print Hello World.