Run osgi bundle from command line

微笑、不失礼 提交于 2019-11-30 13:19:40

问题


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?


回答1:


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



回答2:


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.



来源:https://stackoverflow.com/questions/3601079/run-osgi-bundle-from-command-line

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!