SWT: InvalidSyntaxException

Status
Nicht offen für weitere Antworten.

Vatar

Bekanntes Mitglied
Moin Moin.
Ich möchte mir ein kleines Tool mit JFace schreiben (hab vor einiger Zeit schon was direkt auf SWT gemacht, dachte mir aber warum viel schreiben, wenns auch mit weniger geht).

Um mich einzuarbeiten halte ich mich an dieses Tutorial. Aber bei der MenuBar und der ExitAction haut irgendwas nicht so hin, denn wenn ich ich diese Aktion auslöse (click oder STRG+E) bekommen ich immer folgende Meldung
Code:
java.lang.NoClassDefFoundError: org/osgi/framework/InvalidSyntaxException
	at org.eclipse.core.runtime.Platform.isRunning(Platform.java:1228)
	at org.eclipse.jface.util.Policy.getDebugOption(Policy.java:100)
	at org.eclipse.jface.util.Policy.<clinit>(Policy.java:51)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:909)
	at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:866)
	at org.eclipse.jface.action.ActionContributionItem$7.handleEvent(ActionContributionItem.java:785)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:796)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2772)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2431)
	at org.eclipse.jface.window.Window.runEventLoop(Window.java:668)
	at org.eclipse.jface.window.Window.open(Window.java:648)
	at gui.VersataQuerySearcher.main(VersataQuerySearcher.java:64)
Mein Code schaut folgendermasen aus
Code:
package gui;

import gui.actions.ExitAction;

import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.window.ApplicationWindow;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;


/**
 * This Class provides the GUI using the JFace-Library (built on top of SWT).
 * @author prakew
 */
public class VersataQuerySearcher extends ApplicationWindow {
    
    private ExitAction exitAction;
    
    
    public VersataQuerySearcher (){
        super(null);
        exitAction = new ExitAction(this);
       
    }// end Constructor
    
    
    /**
     * This method from the <code>org.eclipse.jface.window.ApplicationWindow</code>-Class was overriden
     * to set the shell's properties.
     */
    public Control createContents(Composite parent){
        parent.getShell().setText("VersataQuerySearcher");
        parent.getShell().setSize(640, 480);
        parent.getShell().setLocation(0,0);
         
        return parent;
    }// endmethod
    
    
    /**
     * This method from the <code>org.eclipse.jface.window.ApplicationWindow</code>-Class was overriden
     * to create a MenuBar.
     */
    public MenuManager createMenuManager(){
        MenuManager menuBar = new MenuManager();
        MenuManager fileMenu = new MenuManager("&Datei");
        fileMenu.add(exitAction);
        menuBar.add(fileMenu);
        return menuBar;
    }// endmethod
    
    
    /**
     * Just creates a new <code>VersataQuerySearcher</code>-Object.
     * @param args
     */
    public static void main(String [] args){
        VersataQuerySearcher vqs = new VersataQuerySearcher();
        vqs.addMenuBar();
        /* Sorg dafür, dass nach dem Aufruf von Open so lange gewartet wird bis der User das Fenster schließt.
         * Erst wenn es geschlossen wurde, wird die nächste Zeile ausgeführt und die Ressourcen freigegeben. */
        vqs.setBlockOnOpen(true);
        vqs.open();
        // Ressourcen freigeben
        Display.getCurrent().dispose();
    }// endmethod main
}// end Class


------------------------------------------------------------------------
package gui.actions;

import org.eclipse.jface.action.Action;
import org.eclipse.jface.window.ApplicationWindow;



public class ExitAction extends Action {

    ApplicationWindow window;
    
    public ExitAction(ApplicationWindow w){
        window = w;
        setText("E&xit@Ctrl+E");
    }// end Constructor
    
    public void run(){
        System.out.println("Exit Application");
        window.close();
    }// endmethod
}// end Class

Thx
 

Vatar

Bekanntes Mitglied
Hat niemand eine Ahnung, woran das liegen kann? Ich probier nun schon ne ganze Weile daran herum. Sobald ich auf Exit clicke kommt diese Exception, bis zu meiner Action kommt er gar nicht mehr.

Ich habe das swt.jar, jface.jar, runtime.jar und das workbench.jar im Classpath, sowie sämtliche SWT-dlls.
 

ronny

Bekanntes Mitglied
Ich vermute mal, da fehlen noch ein paar jars...

swt.jar
osgi.jar
jface.jar
jfacetext.jar
compatibility.jar
runtime.jar

sind bei mir drin...

Im Notfall kannst du auch mal den VE installieren (sofern du mit eclipse arbeitest)..
Der erstellt dir eine SWT Bibliothek, die alles wichtige enthält...
 

Vatar

Bekanntes Mitglied
Es tut. Dass muss einem ja mal einer sagen, vor allem weil das Zeug an den unterschiedlichsten Stellen liegt.

Vielen Dank
 
Status
Nicht offen für weitere Antworten.

Neue Themen


Oben