【问题标题】:Exported package doesn't visible in runtime导出的包在运行时不可见
【发布时间】:2013-08-22 09:55:45
【问题描述】:

我有以下问题。

我有一个基于 OSGI 的应用程序,我需要使用库 org.chromiunm.debug.ui。我将此库和所有相关库添加到目标平台。

我想在 org.chromium.sdk.ui.launcher 包中的这个库中使用的类。为此,我在清单文件中添加以下行:

 Import-Package: org.chromium.debug.ui

在 Eclipse 开发过程中,这个类是正确可见的,我可以使用它。但在运行时第一次访问时出现错误:

java.lang.NoClassDefFoundError: org/chromium/debug/ui/launcher/WipLaunchType

可能的问题是什么?

【问题讨论】:

    标签: eclipse eclipse-plugin osgi eclipse-rcp bundle


    【解决方案1】:

    Java 中的包不是嵌套的...org/chromium/debug/ui/launcher/WipLaunchTypeorg.chromium.debug.ui.launcher.WipLaunchType,它是包 org.chromium.debug.ui.launcher 中的类 WipLaunchType

    导入org.chromium.debug.ui 不包含子包,因为您没有导入org.chromium.debug.ui.launcher,所以您会在WipLaunchType 类上收到错误...

    如果您使用过 bnd(tools),则不必指定此导入,因为 bnd 会从您的类文件中计算出来...

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-10-28
      • 1970-01-01
      • 1970-01-01
      • 2017-08-06
      • 1970-01-01
      • 1970-01-01
      • 2014-11-17
      • 1970-01-01
      相关资源
      最近更新 更多