java 从命令行运行 osgi bundle
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3601079/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Run osgi bundle from command line
提问by Hectoret
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:
我开发了一个 OSGi 包,我通常从 Eclipse 进行测试。在导出包之后,我得到了一个 bundle.jar 文件。我希望能够从命令行运行生成的文件。就像是:
C:\java -jar bundle.jar osgi_framework path
C:\java -jar bundle.jar osgi_framework 路径
But, how to include the osgi framework in it? and also, how can I start the bundle immediately?
但是,如何在其中包含 osgi 框架?而且,我怎样才能立即开始捆绑?
采纳答案by Neil Bartlett
You can start the OSGi framework from the command line as follows. First for Equinox:
您可以从命令行启动 OSGi 框架,如下所示。首先是Equinox:
java -jar org.eclipse.osgi_VERSION.jar -console
NB. substitute VERSION for the version of Equinox you have installed. For Felix:
注意。将 VERSION 替换为您已安装的 Equinox 版本。对于菲利克斯:
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
回答by Keqiang Li
Though it's a really old question but people are having problems running the osgi console with command java -jar org.eclipse.osgi.jar -consolesince the lack of several bundles needed like the comments to Neil's answer.
虽然这是一个非常古老的问题,但是人们在使用命令运行 osgi 控制台时遇到了问题,java -jar org.eclipse.osgi.jar -console因为缺少需要的几个捆绑包,例如对 Neil 的回答的评论。
See my answer hereto get the instructions on how to run the osgi console. After osgi console starts, just follow Neil's answer to install your own bundles.
请在此处查看我的回答以获取有关如何运行 osgi 控制台的说明。osgi 控制台启动后,只需按照 Neil 的回答安装您自己的包。

