Karaf in Eclipse IDE?

How can I enable the Karaf container in the Eclipse IDE? It always running equinox

[Just installed a new workspace using the latest instructions and setup tasks -> is also not running Karaf]


1 Like

Karaf is not a replacement for Equinox - it actually runs Equinox as well. It is just a framework for handling the configuration and startup of the OSGi framework. So it is either Karaf or Eclipse IDE, which you use for launching.

Ok. But how to debug that launch process? as I sense that discussion in https://github.com/openhab/openhab2-addons/pull/21 is linked to Karaf, as it works perfectly well under the IDE

Best is to do remote debugging on Karaf. Unfortunately, there is no way to do that directly from the sources from the IDE. See also http://stackoverflow.com/questions/30736380/best-way-to-debug-osgi-bundles-in-karaf.

We might be able to bring a bit more of the Karaf startup behavior to the IDE setup, if we replace the Equinox ConfigAdmin and DS by the Apache Felix services. I once tried that locally and it seemed to work.
We would need to add the Felix services to the target platform for that. @davy, do you maybe want to look into this, as you have setup the target platform repo build?

Having played around with Karaf for a few hours I feel a bit lost. I think it would be handy if one of the Karaf experts could write up a small how-to that is relevant for ESH/OH2 and explain how to achieve certain things like:

  • Compiling a bundle in Eclipse, export it to the Karaf distro, have it integrated in that distro (how to automate?), and run it/debug it
  • Start a Karaf distro from the files that make up the Eclipse workspace and git folder (if possible at all)
  • How to get maximum TRACE output for debugging purposes (remote debugging the Karaf runtime does not bring salvation IMO)


1 Like

I agree that this should be all documented for developers and many other things need to be documented as well.

I think once we get a structured documentation started, things will become easier for everyone…

For the stackoverflow, it seem to me that if we can start karaf/OH2 instance, then we can attach that running instance within Eclipse.
Then we can use both Eclipse and Karaf simultaneously.
I am really new to Java. Please correct me if have some misunderstanding here.

If that’s the case, then we may need to do is to start karaf/OH2 instance.
However, I have not much idea how to do that.
For snapshot, we can just
For Eclipse workspace stuff, although start_debug.sh within openhab-distro can be found, don’t know how to trigger running OH2/karaf outside Eclipse.

Can expert shed some light whether it can be accomplished by some manual work or it is not a easy job?
Thank you very much.

Hi Kai, it seems to me that you have add some more plugin as Felix services to Eclipse to make karaf console to replace the original osgi console.
I understand it can be done in target platform file as openHAB.target.

Frankly, I am new to Java platform, mostly I am from C world.

1 Is there some simple way to do add the plugin manually, like download plugin package files, then put them into somewhere?

2 If so, would you please expose some more info how to do that?
If not, would you also please provide some guidance for the direction to add new plugin into the target platform?

3 My last question is, as karaf console is replaced osgi console in OH2 latest version, am I correct to say karaf console is also a better option together with Eclipse IDE?
Or there is not much difference to use karaf console or osgi console with Eclipse IDE?

Thank you very much.