简体   繁体   English

通过外部Eclipse项目在RCP应用程序中添加jar

[英]add jars in an RCP app via an external eclipse project

I am learning rcp development, and currently I try to import some SWT widgets into an e4 RCP app, but I have problems. 我正在学习rcp开发,当前我尝试将一些SWT窗口小部件导入e4 RCP应用程序,但是我遇到了问题。

I found jars for the XYGraph component here , and from the tutorial of lars Vogel, I learned to import some jars in an RCP app: I created a "Project from jars" in eclipse, in which I put all the jars (not only those mentionned above, but also others from the nebula project, but it not linked to the problem I get). 我在这里找到了XYGraph组件的jar,并且从lars Vogel的教程中,我学会了在RCP应用程序中导入一些jar:我在eclipse中创建了一个“ jars项目”,在其中放置了所有jar(不仅是上面提到的,还有其他来自星云计划的人,但它与我得到的问题无关)。 then, I added the plugin project with the jars in the manifest file of my RCP app(in the dependencies tab). 然后,在我的RCP应用程序的清单文件中(在“依赖项”选项卡中),将带有jar的插件项目添加到该项目中。 After that, I added the right "import" statements in my part file, and all should be good... but I get this error when I launch the RCP app(from the product file): java.lang.NoClassDefFoundError: org/eclipse/draw2d/IFigure at the line 51 之后,我在零件文件中添加了正确的“ import”语句,并且一切都应该很好...但是当我启动RCP应用程序(从产品文件)时出现此错误:java.lang.NoClassDefFoundError:org / eclipse / draw2d / IFigure在第51行

here is me RCP @postConstruct file: an arrow shows the line 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);
}

do you have an idea about the origin of this error? 您是否有关于此错误起因的想法?

EDIT: here are all the 4 files: 编辑:这是所有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

EDIT 2: 编辑2: 在此处输入图片说明

Did you add the corresponding exported packages in runtime tab of the manifest file created for XYGraph (and others...) plugin ? 您是否在为XYGraph(及其他...)插件创建的清单文件的运行时选项卡中添加了相应的导出包?

EDIT 1 : Try to tune your plugins from your launch configuration. 编辑1:尝试从启动配置中调整插件。 You can access launch configuration from Run->Run Configurations... menu. 您可以从运行->运行配置...菜单中访问启动配置。 Check if your plugin configuration is valid. 检查您的插件配置是否有效。

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM