【问题标题】:EclipseEnvironmentInfo class is unavailable in osgi bundle 3.10 onwardsEclipseEnvironmentInfo 类在 osgi bundle 3.10 及以后版本中不可用
【发布时间】:2015-04-24 12:44:55
【问题描述】:

我正在使用 EclipseEnvironmentInfo.getDefault().getCommandLineArgs() 来获取命令行参数。

在从 3.10 版开始的最新 osgi 中,此类和方法不可用。

谁能告诉我在最新的 osgi jar 中这个等价物是什么?

【问题讨论】:

    标签: eclipse osgi


    【解决方案1】:

    它是EquinoxConfiguration,但这是一个内部类,所以我不建议使用它。

    Platform.getCommandLineArgs() 是一个公共方法。

    或者,您可以从 OSGi 服务获取 EnvironmentInfo 实现(代码取自 org.eclipse.equinox.internal.app.Activator):

    BundleContext bc = ...;
    ServiceReference infoRef = bc.getServiceReference(EnvironmentInfo.class.getName());
    EnvironmentInfo envInfo = (EnvironmentInfo) bc.getService(infoRef);
    bc.ungetService(infoRef);
    

    【讨论】:

      猜你喜欢
      • 2016-02-03
      • 2014-11-16
      • 1970-01-01
      • 1970-01-01
      • 2021-09-13
      • 2015-12-30
      • 2012-01-03
      • 2012-04-17
      • 2011-09-21
      相关资源
      最近更新 更多