【发布时间】:2015-09-26 00:53:37
【问题描述】:
我正在开发一个 OSGI equinox 启动器,它应该启动 OSGI 框架和 equinox 控制台。我已将五个 jar 添加到一个名为插件的文件夹中,作为类路径/构建路径的一部分,但仍然无法执行。
以下是在 linux 控制台上成功执行并在 linux 控制台上打开 osgi> 提示符的命令。
java-Dosgi.bundles=org.eclipse.equinox.console_1.1.0.v20140131-1639.jar.@start,org.apache.felix.gogo.command_0.10.0.v201209301215.jar@start,org.apache。 felix.gogo.runtime_0.10.0.v201209301036.jar@start,org.apache.felix.gogo.shell_0.10.0.v201212101605.jar@start -jar org.eclipse.osgi_3.10.0.v20140606-1445.jar -console
但上面的代码在我的代码中失败了,如下所示
public static void main(String[] args) {
字符串命令="java-Dosgi.bundles=plugin/org.eclipse.equinox.console_1.1.0.v20140131-1639.jar@start,plugin/org.apache.felix.gogo.command_0.10.0.v201209301215.jar @start,plugin/org.apache.felix.gogo.runtime_0.10.0.v201209301036.jar@start,plugin/org.apache.felix.gogo.shell_0.10.0.v201212101605.jar@start -jar plugin/org.eclipse。 osgi_3.10.1.v20140909-1633.jar -console";
try {
// using the Runtime exec method:
Process p = Runtime.getRuntime().exec(command);
BufferedReader stdInput = new BufferedReader(new
InputStreamReader(p.getInputStream()));
BufferedReader stdError = new BufferedReader(new
InputStreamReader(p.getErrorStream()));
// read the output from the command
System.out.println("Here is the standard output of the command:\n");
while ((s = stdInput.readLine()) != null) {
System.out.println(s);
}
// read any errors from the attempted command
System.out.println("Here is the standard error of the command (if any):\n");
while ((s = stdError.readLine()) != null) {
System.out.println(s);
}
System.exit(0);
}
catch (IOException e) {
System.out.println("exception happened - here's what I know: ");
e.printStackTrace();
System.exit(-1);
}
}
错误如下 这是命令的标准输出:
这是命令的标准错误(如果有的话):
错误:无法访问jarfile插件/org.eclipse.osgi_3.10.1.v20140909-1633.jar
【问题讨论】:
标签: java jakarta-ee osgi osgi-bundle dosgi