I have an application that works fine on Mac OS X with FWT.
However, I have compiled it to a Jar archive and I have a strange error at launch:
***WARNING: Display must be created on main thread due to Cocoa restrictions.
sys::Err: org.eclipse.swt.SWTException: Invalid thread access
org.eclipse.swt.SWT.error (Unknown)
org.eclipse.swt.SWT.error (Unknown)
org.eclipse.swt.SWT.error (Unknown)
org.eclipse.swt.widgets.Display.error (Unknown)
org.eclipse.swt.widgets.Display.createDisplay (Unknown)
org.eclipse.swt.widgets.Display.create (Unknown)
org.eclipse.swt.graphics.Device.<init> (Unknown)
org.eclipse.swt.widgets.Display.<init> (Unknown)
org.eclipse.swt.widgets.Display.<init> (Unknown)
fwt::Fwt.<init> (Fwt.java:453)
fwt::Fwt.<init> (Fwt.java:29)
fwt::Fwt$1.initialValue (Fwt.java:58)
java.lang.ThreadLocal.setInitialValue (ThreadLocal.java:141)
java.lang.ThreadLocal.get (ThreadLocal.java:131)
fwt::Fwt.get (Fwt.java:41)
fwt::WindowPeer.open (WindowPeer.java:149)
fwt::Window.open (Window.fan)
Does anyone know a workaround ? this seems to be a bug due to the way FWT handles threading. Again, it works fine with the fan compiler.
Thanks,
brianMon 12 Sep 2011
It is an annoying aspect of Java + OS X. The work around is to use a special flag to your Java runtime -XstartOnFirstThread. That is what we use in Fantom's launcher code.
sarnold Mon 12 Sep 2011
Hello,
I have an application that works fine on Mac OS X with FWT.
However, I have compiled it to a Jar archive and I have a strange error at launch:
Does anyone know a workaround ? this seems to be a bug due to the way FWT handles threading. Again, it works fine with the fan compiler.
Thanks,
brian Mon 12 Sep 2011
It is an annoying aspect of Java + OS X. The work around is to use a special flag to your Java runtime
-XstartOnFirstThread
. That is what we use in Fantom's launcher code.