tags:

views:

189

answers:

2

I've got a java project that uses an SWT UI and I'm having trouble deploying it on any Mac OS X computers. The program itself works perfectly on Windows when it is either run from within Eclipse or from a jar file. On Mac, the program also works fine in Eclipse, but when I try to run it from a jar file, I get the following error:

2010-04-30 13:33:04.564 java[17825:41b] *** _NSAutoreleaseNoPool(): Object 0x10b9b0 of class NSCFString autoreleased with no pool in place - just leaking
Stack: (0x944acf4f 0x943b9432 0x678fb79 0x35a19b1 0x359ba7f)
2010-04-30 13:33:04.566 java[17825:41b] *** _NSAutoreleaseNoPool(): Object 0x115ef0 of class NSCFNumber autoreleased with no pool in place - just leaking
Stack: (0x944acf4f 0x943b9432 0x678a0b0 0x35a19b1 0x359ba7f)
2010-04-30 13:33:04.567 java[17825:41b] *** _NSAutoreleaseNoPool(): Object 0x121000 of class NSCFString autoreleased with no pool in place - just leaking
Stack: (0x944acf4f 0x943b9432 0x678fb79 0x35a19b1)
2010-04-30 13:33:04.581 java[17825:41b] *** _NSAutoreleaseNoPool(): Object 0x123720 of class NSPathStore2 autoreleased with no pool in place - just leaking
Stack: (0x944acf4f 0x943ba637 0x943c238f 0x943c1e8e 0x943c694b 0x678992e 0x35a19b1)
2010-04-30 13:33:04.582 java[17825:41b] *** _NSAutoreleaseNoPool(): Object 0x12d660 of class NSPathStore2 autoreleased with no pool in place - just leaking
Stack: (0x944acf4f 0x943ba637 0x943b9739 0x943c3eb2 0x943c6b22 0x678992e 0x35a19b1)
...
...
...

The actual error is much larger, and continues until the program crashes.

I know that I am using the correct swt.jar file and I have tried running the program with the -XstartOnFirstThread VM argument, but still have not had any luck.

Does anybody have any ideas or any suggestions where I could start looking for a solution?

Thanks.

A: 

SWT does not have garbage collection .. My guess is that the code you are running is causing an OS memory leak which is being reported through the eclipse console.

My suspicion is confirmed by the error message not being a Java error message, but an Obj-c error message instead.

you can read more about it here.. http://www.eclipse.org/articles/swt-design-2/swt-design-2.html

and here is a link talking about the Obj-c error you are actually seeing. http://www.idevgames.com/forum/archive/index.php/t-7710.html

good luck!

sanimalp
+1  A: 

Is the application bundled or are you running it from the command line? If bundled, you need to put the key StartOnMainThread with value true in the Java dictionary of the Info.plist file. If not bundled, the argument is java -XstartOnFirstThread. Yes, they are different, and yes, that's unfortunately annoying.

Scott K.
This is definitely what you'll see if the StartOnFirstThread option is not set in SWT on Mac OS X.
Matthew Phillips
could you elaborate a bit? I have a similar situation, where SWT execution fails with an SWTException with description: "Invalid Thread Access". I suspect it also might have something to do with the main thread
posdef
SWT operations on the Mac must always happen on the main thread, and also must be on the same thread that created the Display. That exception sounds like you're calling the SWT from a different thread.
Scott K.