I'm not sure what's causing this, but the java ffi swing.fan example will not run on my Mac OS X 10.5.6 box either. When I run it, it just hangs and does nothing (never exits). The java ffi hello.fan example runs fine, however.
I wrote the smallest possible swing app, to see if I could narrow down the problem:
#! /usr/bin/env fan
using [java] javax.swing
class SwingDemo
{
static Void main()
{
echo("starting")
frame := JFrame()
}
}
This also hangs, and never echos "starting". I tried flushing the output buffer after the echo, but still nothing is printed. I'm wondering now if the code is getting past the compilation stage - is there a way I can check this?
All the same code runs fine on my Ubuntu box, so this issue seems to be specific to either my OS version or my setup. Heres my fan -version info:
java.vm.name: Java HotSpot(TM) Client VM
java.vm.vendor: Apple Inc.
java.vm.version: 1.5.0_16-133
java.home: /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home
fan.home: /Users/kevin/Library/fan
sys.version: 1.0.40
Appreciate any help or ideas you might have.
brianTue 7 Apr 2009
Is it possible you are using a custom script to launch Fan? OS X requires you to pass the -XstartOnFirstThread option to Java for SWT to work. Other than that I have no idea. You said a simple Swing and simple SWT program written in Java/Groovy works ok? What does the thread dump look like?
but still nothing is printed. I'm wondering now if the code is getting past the compilation stage - is there a way I can check this?
Pass -fcodeDump which should dump the fcode before calling out to the script's main.
kevykevTue 7 Apr 2009
Hmm.. OK, I think i've found the problem.
I was using the default script to launch fan, which adds the -XstartOnFirstThread flag needed for SWT. However, on my system, this flag actually breaks swing apps.
So, at least on my system, the -XstartOnFirstThreadmust be specified to run SWT applications, and must not be specified to run swing applications. The reason for this is explained here.
If I remove the -XstartOnFirstThread from fanlaunch then I can run swing apps, but not FWT apps. This is tricky to fix too: fanlaunch would have to find out somehow if the application is FWT based, and append the -XstartOnFirstThread flag only if it is...
brianTue 7 Apr 2009
This whole problem might go away with the actor changes. I used to spawn the main thread to be a subclass of sys::Thread. But I stripped that code out with the change to actors (it isn't in last build, only in hg tip).
kaushikThu 9 Dec 2010
Just updating, when -XstartOnFirstThread is on, it simply makes my app hang in certain places. Ran into #996 today. Could we provide a flag to switch this off?
kevykev Tue 7 Apr 2009
Hi,
I'm not sure what's causing this, but the java ffi
swing.fan
example will not run on my Mac OS X 10.5.6 box either. When I run it, it just hangs and does nothing (never exits). The java ffihello.fan
example runs fine, however.I wrote the smallest possible swing app, to see if I could narrow down the problem:
This also hangs, and never echos "starting". I tried flushing the output buffer after the echo, but still nothing is printed. I'm wondering now if the code is getting past the compilation stage - is there a way I can check this?
All the same code runs fine on my Ubuntu box, so this issue seems to be specific to either my OS version or my setup. Heres my
fan -version
info:Appreciate any help or ideas you might have.
brian Tue 7 Apr 2009
Is it possible you are using a custom script to launch Fan? OS X requires you to pass the
-XstartOnFirstThread
option to Java for SWT to work. Other than that I have no idea. You said a simple Swing and simple SWT program written in Java/Groovy works ok? What does the thread dump look like?Pass -fcodeDump which should dump the fcode before calling out to the script's main.
kevykev Tue 7 Apr 2009
Hmm.. OK, I think i've found the problem.
I was using the default script to launch fan, which adds the
-XstartOnFirstThread
flag needed for SWT. However, on my system, this flag actually breaks swing apps.So, at least on my system, the
-XstartOnFirstThread
must be specified to run SWT applications, and must not be specified to run swing applications. The reason for this is explained here.If I remove the
-XstartOnFirstThread
fromfanlaunch
then I can run swing apps, but not FWT apps. This is tricky to fix too:fanlaunch
would have to find out somehow if the application is FWT based, and append the-XstartOnFirstThread
flag only if it is...brian Tue 7 Apr 2009
This whole problem might go away with the actor changes. I used to spawn the main thread to be a subclass of
sys::Thread
. But I stripped that code out with the change to actors (it isn't in last build, only in hg tip).kaushik Thu 9 Dec 2010
Just updating, when -XstartOnFirstThread is on, it simply makes my app hang in certain places. Ran into #996 today. Could we provide a flag to switch this off?
LESSIE32ARMSTRONG Sat 11 Jun 2011
Comment removed.
ByrdTina24 Fri 24 Jun 2011
Comment removed.