java swt problem
Har skapat ett enkelt program i Java för att testa SWT.
I Eclipse går det att köra programmet. Men om jag kompilerar det och kör det från Terminalen eller från NetBeans så får jag följande felmeddelande:
2009-09-22 22:16:20.805 java[72461:d07] *** __NSAutoreleaseNoPool(): Object 0x1001591d0 of class NSView autoreleased with no pool in place - just leaking
2009-09-22 22:16:20.806 java[72461:d07] *** __NSAutoreleaseNoPool(): Object 0x101460500 of class NSCFArray autoreleased with no pool in place - just leaking
2009-09-22 22:16:20.810 java[72461:d07] *** __NSAutoreleaseNoPool(): Object 0x100115e30 of class __NSArray0 autoreleased with no pool in place - just leaking
2009-09-22 22:16:20.812 java[72461:d07] *** __NSAutoreleaseNoPool(): Object 0x10015b410 of class NSCFString autoreleased with no pool in place - just leaking
2009-09-22 22:16:20.816 java[72461:1707] *** __NSAutoreleaseNoPool(): Object 0x1001628f0 of class NSCFArray autoreleased with no pool in place - just leaking
Exception in thread "Thread-12" org.eclipse.swt.SWTException: Invalid thread access
at org.eclipse.swt.SWT.error(Unknown Source)
at org.eclipse.swt.SWT.error(Unknown Source)
at org.eclipse.swt.SWT.error(Unknown Source)
at org.eclipse.swt.widgets.Widget.error(Unknown Source)
at org.eclipse.swt.widgets.Widget.checkWidget(Unknown Source)
at org.eclipse.swt.widgets.Shell.isEnabled(Unknown Source)
at org.eclipse.swt.widgets.Control.updateTrackingAreas(Unknown Source)
at org.eclipse.swt.widgets.Display.windowProc(Unknown Source)
Min kod ser ut som följer:
package swttest;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
public class Main {
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
}
Någon som vet hur jag får det att köra utanför Eclipse? Använder MacOS 10.6 och Java 1.6.