简体   繁体   English

从命令行运行osgi bundle

[英]Run osgi bundle from command line

I developed an OSGi bundle, which I usually test from Eclipse. 我开发了一个OSGi包,我通常从Eclipse测试。 Aftrer exporting the bundle, I get a bundle.jar file. Aftrer导出捆绑包,我得到一个bundle.jar文件。 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 C:\\ java -jar bundle.jar osgi_framework路径

But, how to include the osgi framework in it? 但是,如何在其中包含osgi框架? and also, how can I start the bundle immediately? 而且,我怎么能立即启动捆绑?

You can start the OSGi framework from the command line as follows. 您可以从命令行启动OSGi框架,如下所示。 First for Equinox: 首先是Equinox:

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

NB. NB。 substitute VERSION for the version of Equinox you have installed. 将VERSION替换为您已安装的Equinox版本。 For Felix: 对于菲利克斯:

java -jar bin/felix.jar

Now using the OSGi console, install your own bundle: 现在使用OSGi控制台,安装自己的包:

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

And start it: 然后开始吧:

osgi> start 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. 虽然这是一个非常古老的问题,但人们在使用命令java -jar org.eclipse.osgi.jar -console运行osgi控制台时遇到问题,因为缺少几个捆绑包需要像对Neil的回答的评论。

See my answer here to get the instructions on how to run the osgi console. 见我的答案在这里 ,以获取有关如何运行OSGi控制台的指令。 After osgi console starts, just follow Neil's answer to install your own bundles. 在osgi控制台启动后,只需按照Neil的回答安装自己的捆绑包。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM