Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run osgi bundle from command line

Tags:

java

bundle

osgi

I developed an OSGi bundle, which I usually test from Eclipse. Aftrer exporting the bundle, I get a bundle.jar file. I would like to be able to run the generated file from the command line. Something like:

C:\java -jar bundle.jar osgi_framework path

But, how to include the osgi framework in it? and also, how can I start the bundle immediately?

like image 960
Hectoret Avatar asked Aug 30 '10 14:08

Hectoret


People also ask

How do I run OSGi bundle?

Procedure. Install the plug-in bundle into the Eclipse Equinox OSGi framework with the OSGi console. Start the Eclipse Equinox framework with the console enabled. Install the plug-in bundle in the Equinox console.

How do I debug OSGi bundle in Eclipse?

To run your bundles, right click and choose Run as ->OSGi Framework (or debug as). You can tweak which bundles are included in the runtime configuration, and what arguments are used. You may for example want to add -console . You can also create an application for export, which will give you a config.


2 Answers

You can start the OSGi framework from the command line as follows. First for Equinox:

java -jar org.eclipse.osgi_VERSION.jar -console

NB. substitute VERSION for the version of Equinox you have installed. For Felix:

java -jar bin/felix.jar

Now using the OSGi console, install your own bundle:

osgi> install file:/path/to/my/bundle.jar
Bundle ID is 2

And start it:

osgi> start 2
like image 50
Neil Bartlett Avatar answered Oct 03 '22 07:10

Neil Bartlett


Though it's a really old question but people are having problems running the osgi console with command java -jar org.eclipse.osgi.jar -console since the lack of several bundles needed like the comments to Neil's answer.

See my answer here to get the instructions on how to run the osgi console. After osgi console starts, just follow Neil's answer to install your own bundles.

like image 24
lkq Avatar answered Oct 03 '22 08:10

lkq