2013-06-18 115 views
1

导出我正在开发为可部署功能的插件后,出现类未找到异常。使用IWorkspaceRunnable后未发现类异常

通常我将生成的Jar放置在dropins文件夹中,我可以使用它。但是在添加了使用IWorkspaceRunnable保存更改资源的正确方法之后,当我尝试运行已部署的插件时,我开始获取非Class Def Exception。 (注意:该插件运行良好,无需部署测试它的时候,又名运行像Eclipse应用程序)

IWorkspaceRunnable saveTask = new IWorkspaceRunnable() { 

     @Override 
     public void run(IProgressMonitor monitor) throws CoreException { 
      if (fileName != null) try { 
       myEditor.save(new File(fileName)); 
       firePropertyChange(PROP_DIRTY); 
       ResourcesPlugin.getWorkspace().getRoot().refreshLocal(IResource.DEPTH_INFINITE, null); 
      } catch (Exception e) { 
       e.printStackTrace(); 
       JOptionPane.showMessageDialog(null, "Error while saving: \n"+e.toString()); 
      } 
     } 
    }; 
    try { 
     ResourcesPlugin.getWorkspace().run(saveTask, null); 
    } catch (CoreException e) { 
     e.printStackTrace(); 
     JOptionPane.showMessageDialog(null, "Error while saving: \n"+e.toString()); 
    } 

任何想法如何得到这个工作?

org.eclipse.core.resources,它包含IWorkspaceRunnable,已经出现在我的“插件依赖项”文件夹中。我认为它在某个时候自动到达那里。有什么地方我应该把/引用特定的罐子?我没有为我在org.eclipse。*中使用的其他类进行其他任何操作。

编辑:这里是MANIFEST.MF

Manifest-Version: 1.0 
Bundle-ManifestVersion: 2 
Bundle-Name: MyPlugin 
Bundle-SymbolicName: MyPlugin;singleton:=true 
Bundle-Version: 1.0.0.1 
Require-Bundle: org.eclipse.ui,org.eclipse.core.runtime,org.eclipse.ui 
,org.eclipse.core.runtime,org.eclipse.jface.text,org.eclipse.ui.edito 
rs,org.eclipse.ui.ide,org.eclipse.core.resources;visibility:=reexport 
Bundle-ActivationPolicy: lazy 
Bundle-RequiredExecutionEnvironment: JavaSE-1.7 
Bundle-Vendor: myVendor 
Bundle-ClassPath: /usr/share/eclipse/plugins/,. 

我是如何部署的插件:

我放置在的.jar /home//.eclipse/org.eclipse。 platform_/dropins /,版本为4.2.0_1543616141。这可能不是部署它的正确方式,但在添加对org.eclipse.core.resources的引用之前它已工作。

我有兴趣创建一个可以放在dropins文件夹中并运行的独立插​​件。

+0

你可以用你的插件MANIFEST.MF的样子来更新这个问题吗? –

+0

@PaulWebster我加了MANIFEST.MF,那里有什么不寻常的东西? –

+0

你的bundle classpath中不能有/ usr/share/eclipse/plugins,只有'.'或者jar包含在你的插件中。任何来自插件的东西都可以从您的RCP应用程序中获得。 –

回答

0

ClassNotFoundException指示类路径上缺少某些内容。也许你在类路径中缺少一个库。

顾名思义,Java中的classNotFoundException是java.lang.Exception的子类,当Java虚拟机尝试加载特定的类并且未在类路径中找到请求的类时就会出现。