0

我正在开发一个插件,以使用 eclipse Indigo 通过 java 代码创建/编译/运行 CDT 项目。我可以在 Eclipse PDE 中成功运行我的插件。但是当我将它部署到一个 jar 文件中,并将它安装在一个新的 eclipse-java-indigo-win32 中时,我无法运行我的插件。它给出了以下错误。

    java.lang.NoClassDefFoundError: org/eclipse/cdt/core/CCorePlugin
    at    sourceanalysistoolplugin.wizards.CDTProjectManager.createCDTProj(CDTProjectManager.java:43)
at sourceanalysistoolplugin.intermediate.SourceCompileManager.createProject(SourceCompileManager.java:38)
at sourceanalysistoolplugin.actions.SATMenuCompileActionDelegate.run(SATMenuCompileActionDelegate.java:63)
at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:251)
at org.eclipse.ui.internal.WWinPluginAction.runWithEvent(WWinPluginAction.java:229)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
at org.eclipse.jface.action.ActionContributionItem$6.handleEvent(ActionContributionItem.java:452)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4165)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3754)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2701)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2665)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2499)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:679)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:668)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
Caused by: java.lang.ClassNotFoundException: org.eclipse.cdt.core.CCorePlugin
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:513)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 32 more

我在插件依赖项选项卡中添加了 org.eclipse.cdt.core jar 文件。

请指导我解决这个问题。

4

1 回答 1

0

我遇到了类似的问题并尝试了许多不同的“解决方案”(其中一些对其他人有用,但没有一个对我有用)。我终于发现了如何使用我的 Android 应用程序使用和打包 JAR 文件?有答案(至少对我来说)——我不得不使用 JDK 1.6 重新编译 jar。用 1.7 编译从来没有用过。一旦我重新编译并重新加载了新的 jar,它就工作得很好。希望有帮助。

于 2012-07-11T18:56:30.193 回答