有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

使用IWorkSpaceUnable后未找到java类异常

在将我正在开发的插件导出为可部署特性之后,我得到了类NotFoundException

通常我会将生成的Jar放在dropins文件夹中,这样我就可以使用它了。但是,在使用IWorkspaceRunnable添加了似乎是保存资源更改的正确方法之后,当我尝试运行部署的插件时,我开始出现not Class Def异常。(请注意,插件在测试时运行良好,无需部署,即作为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使用的其他类做任何其他事情。月食*

编辑:这是清单。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 in/home/。eclipse/org。日食平台u/dropins/,版本为4.2.0 1543616141。这可能不是部署它的正确方法,但在添加对org.eclipse.core.resources的引用之前,它就起作用了

我感兴趣的是创建一个独立的ish插件,它可以放到dropins文件夹中,然后运行


共 (1) 个答案

  1. # 1 楼答案

    ClassNotFoundException表示类路径上缺少某些内容。也许你错过了类路径中的一个库

    As the name suggests classNotFoundException in Java is a subclass of java.lang.Exception and Comes when Java Virtual Machine tries to load a particular class and doesn't found the requested class in classpath.