2015-05-11 4 views
1

В моей программе java я пытаюсь создать FileDialog для сохранения файлов. Но я получаю эту ошибку.SWT FileDialog с java.lang.ClassNotFoundException

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; 
    } 

После поиска в течение нескольких дней, я до сих пор не имею ни малейшего представления об этом. Кто-нибудь может помочь?

EDIT:

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 

ххх просто назвать некоторых других пучков, но я не могу показать здесь.

+0

Какая программа Java это? Из трассировки стека это выглядит как плагин Eclipse - это правильно? –

+0

@ greg-449 Да, вы правы. Я работаю с RAP и OSGi. – gamo

+0

Покажите нам содержимое плагина MANIFEST.MF –

ответ

1

Вам необходимо добавить org.eclipse.swt в список Require-Bundle в файле MANIFEST.MF для вашего плагина.

Вы можете сделать это в редакторе plugin.xml на вкладке «Зависимости» в таблице «Необходимые подключаемые модули».

+0

А, я пропустил его. Большое спасибо за ваш ответ. – gamo

Смежные вопросы