带有java.lang.ClassNotFoundException的SWT文件对话框

带有java.lang.ClassNotFoundException的SWT文件对话框,java,eclipse-plugin,swt,Java,Eclipse Plugin,Swt,在我的java程序中,我试图创建一个文件对话框来保存文件。但我得到了这个错误 Caused by: java.lang.ClassNotFoundException: org.eclipse.swt.widgets.FileDialog cannot be found by xxx.xxx.maintenance_1.0.0 at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.ja

在我的java程序中,我试图创建一个文件对话框来保存文件。但我得到了这个错误

Caused by: java.lang.ClassNotFoundException: org.eclipse.swt.widgets.FileDialog cannot be found by xxx.xxx.maintenance_1.0.0
    at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:423)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:336)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:328)
    at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:160)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    ... 24 more
以下是我创建对话框的方式:

    public DownloadLogFilesDialog(Shell parent, int style) {
        super(parent, style);
        shell = new Shell(getParent(), SWT.APPLICATION_MODAL);
        fileDialog = new FileDialog(shell, style); // error at this line
    }

    @SuppressWarnings("javadoc")
    public Object open() {
        shell.setSize(width, height);
        Rectangle parentBounds = getParent().getBounds();
        shell.setLocation(
            parentBounds.x + (parentBounds.width - width) / 2,
            parentBounds.y + (parentBounds.height - height) / 2);

        fileDialog.setText("Download Log Files"); //$NON-NLS-1$
        fileDialog.setFilterPath(System.getProperty("user.home")); //$NON-NLS-1$
        Object result = fileDialog.open();
        shell.dispose();
        return result;
    }
搜索了几天后,我仍然不知道这件事。有人能帮忙吗

编辑:

MANIFEST.MF

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: System
Bundle-SymbolicName: xxx.xxx.maintenance;singleton:=true
Bundle-Version: 1.0.0
Bundle-Activator: com.xxx.xxx.xxx.ui.maintenance.Activator
Bundle-Vendor: ClareControls
Require-Bundle: 
 org.eclipse.core.runtime;bundle-version="3.10.0",
 org.eclipse.rap.ui;resolution:=optional;visibility:=reexport,
 org.eclipse.rap.ui.forms;resolution:=optional;visibility:=reexport,
 xxx.xxx.common,
 xxx.xxx.db
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-ActivationPolicy: lazy
Import-Package: 
 com.xxx.xxx.xxx.db.entities;version="1.0.0",
 com.xxx.xxx.xxx.ui.common,
 com.xxx.xxx.xxx.ui.common.editors,
 com.xxx.xxx.xxx.ui.common.events,
 com.xxx.xxx.xxx.ui.components,
 com.xxx.xxx.xxx.ui.db,
 com.xxx.xxx.xxx.ui.projects,
 com.xxx.xxx.xxx.ui.projects.editors,
 com.xxx.xxx.xxx.ui.system.dialogs,
 com.xxx.xxx.xxx.ui.system.views,
 com.xxx.xxx.xxx.util,
 javax.persistence;version="[2.0.1,3.0.0)",
 org.apache.commons.io;version="2.0.0",
 org.json
X-Export-Package: com.xxx.xxx.xxx.ui.maintenance

xxx只是一些其他捆绑包的名称,但我不能在这里显示。

您需要将
org.eclipse.swt
添加到MANIFEST.MF中插件的
需要捆绑包列表中


您可以在plugin.xml编辑器中的“所需插件”表中的“依赖项”选项卡上执行此操作。

这是什么类型的Java程序?从堆栈跟踪来看,它可能是一个Eclipse插件-正确吗?@greg-449是的,你是对的。我正在使用RAP和OSGi。向我们展示插件MANIFEST.MF的内容