Regarding my previous answer, both bugs are now closed as fixed.
bug 303869 in particular have been closed early this month with:
I think we can close this bug, it works well now with the latest Java Update for Mac OS X 10.6.
We can execute code on the main thread and now the UI is displayed. In the applet we use code like the following to instantiate the display:
com.apple.concurrent.Dispatch.getInstance().getNonBlockingMainQueueExecutor().execute(
new Runnable(){
@Override
public void run() {
if( dDisplay == null )
{
dDisplay = Display.getDefault();
sShell = SWT_AWT.new_Shell(dDisplay, cCanvas);
mLogger.info("Display is created");
}
...
}
} );
...
Thanks all and especially Mike from Apple to have solved the problem, it was
not so much related to SWT IMHO.
For bug 288436:
Yes, the JNLP file has a small error that is triggering the problem.
Specifying "<j2se version="1.6*" />
" in the "<resources>
" tag without any other attributes is throwing off the JNLP parser and causing the later line "<j2se version="1.6*" java-vm-args="-XstartOnFirstThread"/>
" to be ignored.
The two lines end up referring to two separate JVMs, and the first specification is 'winning'. That spec has no VM arguments on it, so the JVM starts normally, and the SWT is loaded on the wrong thread.
The option -XstartOnFirstThread
is mentioned in bug 211625:
It's needed because Cocoa has a requirement that all user event dispatch must happen on thread 0.
Without -XstartOnFirstThread
, Display will create an NSApplication
on a non-main thread, and the SWT won't be able to pull and dispatch events from the non-main thread.
Be careful though with the -XstartOnFirstThread
option: liek this bug mentions:
The reason for this is that the new Developer Mode is implemented in Swing, and the old Hosted Mode was implemented in SWT.
SWT requires -XstartOnFirstThread to be working on a Mac.
But this however breaks any java program using Swing.
So you cannot add -XstartOnFirstThread
from version 2.0 and forward. On the older versions however it is still a requirement.