【发布时间】:2018-03-10 10:51:55
【问题描述】:
我正在学习 rcp 开发,目前我尝试将一些 SWT 小部件导入到 e4 RCP 应用程序中,但我遇到了问题。
我找到了 XYGraph 组件 here 的 jars,并且从 lars Vogel 的教程中,我学会了在 RCP 应用程序中导入一些 jars:我在 eclipse 中创建了一个“Project from jars”,我把所有的jars(不仅是上面提到的那些,还有来自 nebula 项目的其他,但它与我遇到的问题无关)。 然后,我在我的 RCP 应用程序的清单文件中添加了带有 jar 的插件项目(在依赖项选项卡中)。 之后,我在我的零件文件中添加了正确的“导入”语句,一切都应该很好......但是当我启动 RCP 应用程序(来自产品文件)时出现此错误: java.lang.NoClassDefFoundError: org/eclipse/draw2d/IFigure 在第 51 行
这是我的 RCP @postConstruct 文件:箭头显示第 51 行
@PostConstruct
public void postConstruct(Composite parent) {
parent.setLayout(new FillLayout(SWT.HORIZONTAL));
Canvas canvas = new Canvas(parent, SWT.NONE);
LightweightSystem lws = new LightweightSystem(canvas);
// create a new XY Graph.
XYGraph xyGraph = new XYGraph(); <---- line 51
xyGraph.setTitle("Simple Example");
// set it as the content of LightwightSystem
lws.setContents(xyGraph);
// create a trace data provider, which will provide the data to the
// trace.
CircularBufferDataProvider traceDataProvider = new CircularBufferDataProvider(
false);
traceDataProvider.setBufferSize(100);
traceDataProvider.setCurrentXDataArray(new double[] { 10, 23, 34, 45,
56, 78, 88, 99 });
traceDataProvider.setCurrentYDataArray(new double[] { 11, 44, 55, 45,
88, 98, 52, 23 });
// create the trace
Trace trace = new Trace("Trace1-XY Plot", xyGraph.primaryXAxis,
xyGraph.primaryYAxis, traceDataProvider);
// set trace property
trace.setPointStyle(PointStyle.XCROSS);
// add the trace to xyGraph
xyGraph.addTrace(trace);
}
你知道这个错误的根源吗?
编辑: 这是所有 4 个文件:
NebulaJars (jars plugin): MANIFEST.MF
https://paste.ofcode.org/mchNUQdCpGde3Tf2yKp8Qr
NebulaJars (jars plugin): build.properties
https://paste.ofcode.org/J6UHffTrjvGfWvHSqunQks
RCP project:
MANIFEST.MF
https://paste.ofcode.org/hR7ZkU85qXAqBPjTam53nV
build.properties
https://paste.ofcode.org/DWEc8SV9U85rHMKk4Eb9X3
【问题讨论】:
-
您是否已将包含这些 jar 的插件添加到插件的依赖项中?您是否导出了包含 jar 的插件中的包?向我们展示这两个插件的 MANIFEST.MF 和 build.properties。
标签: java eclipse plugins jar eclipse-rcp