【发布时间】:2021-04-16 00:31:27
【问题描述】:
我有一个包含许多插件项目的 RCP 4 应用程序。该应用程序在 IDE 中运行良好,但是当我在导出后运行它时,抛出了一些异常(ClassNotFoundException)。
我调查后发现这是因为某些类尚未导出到 jar 文件中。我不知道为什么? MANIFEST.MF、plugin.xml、build.properties 中的配置相同,但有些可以将类导出到 jar 文件,有些不能。
你能帮帮我吗?非常感谢!
更新:build.properties 文件
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
item_editor.e4xmi,\
plugin.xml
更新:MANIFEST.MF 文件
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Item_editor
Bundle-SymbolicName: xxx;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: xxx
Require-Bundle: org.eclipse.e4.ui.model.workbench,
org.eclipse.osgi.services,
org.eclipse.jface,
org.eclipse.e4.core.services,
xxx,
xxx,
org.eclipse.nebula.widgets.nattable.core,
org.eclipse.e4.ui.workbench,
org.eclipse.e4.core.contexts,
org.eclipse.e4.core.di,
org.eclipse.core.runtime,
org.eclipse.e4.ui.di,
xxx;bundle-version="1.0.0",
org.eclipse.e4.core.di.extensions;bundle-version="0.15.0",
xxx,
xxx,
xxx
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Import-Package: javax.inject;version="1.0.0"
Export-Package: xxx,
xxx,
xxx,
xxx,
xxx;x-internal:=true,
xxx
【问题讨论】:
-
这通常缺少 build.properties 或 MANIFEST.MF 中的条目。向我们展示有问题的插件的 build.properties 和 MANIFEST.MF。
-
@greg-449:我已经在问题中更新了它们。谢谢!
-
在这个插件中找不到哪些类?它们在出口包裹列表中吗?它们是在主代码中还是在一些额外的 jar 中?
-
它打印出ClassNotFoundException,因为插件找不到丢失的类。类代码在插件里面但是在插件的jar文件里面,没有类文件(全部)。
-
如果您使用的是 Eclipse 'Export Product',请检查构建目录中是否有包含构建错误的 'logs.zip' 文件。
标签: jar export eclipse-rcp .class-file