SWT support and Mac pains

Recently I changed up the way jMonkeyEngine handles embedding in a Canvas. Where previously it was tied hard and fast to an AWT canvas, it is now generic, using registered constructors to allow building other types of canvases. This has been pretty great, allowing us to break up some package dependencies and open things up for new and interesting ways of using jME.

Along with that change, I checked in an implementation for jME in an SWT canvas. Here's where I need to apologize to developers on newer Macs. SWT does not work well in a mixed environment that uses cocoa and even having the swt lib jar from eclipse in your classpath causes errors like this: (even if you are not touching SWT AT ALL, which I find a bit heavy handed.)

2008-07-19 18:14:48.689 java[7031:10b] [Java CocoaComponent compatibility mode]: Enabled
2008-07-19 18:14:48.690 java[7031:10b] [Java CocoaComponent compatibility mode]: Setting timeout for SWT to 0.100000
2008-07-19 18:14:49.633 java[7031:12503] *** -[NSConditionLock unlock]: lock ( '(null)') unlocked when not locked
2008-07-19 18:14:49.633 java[7031:12503] *** Break on _NSLockError() to debug.
(etc...)


If you are not using the properties dialog, jME will launch in the background but be unresponsive to input.

Obviously, this sucks when you are developing because your only other choice is to remove the jar and try to ignore over 100 compile errors. Ugh. So again, sorry.

The ideal situation would be to get a fixed swt jar, but it looks like that will have to wait for the cocoa implementation of swt (possibly part of the eclipse 3.5 release.) I tried to build my own from cvs, but the build script gave me errors about some of the eclipse custom ant tags (even though I have the pde build ant in my ant classpath) and jarring up the bin directory gave me a 2MB jar that still produced the above quoted error and symptoms.

So, in the end, I decided to just write an empty version of the classes and interfaces from swt that jME touches and check that in as a temporary lib for macs with a broken java carbon bridge (or if you are running 64bit only java 6.) At least that way you can compile and run jME (although obviously not the swt part) without errors. Hope that work makes up somewhat for your pain, Mac devs. Find the jar in the /lib/swt/macosx-cocoa/ direction.

You can download the source code for this empty implementation here if you really care to. It's all empty stuff except the SWT class which is copied partially from the real thing.

The latest

It's been pretty slow on my blog lately, and mostly that's because life has been very busy here. I've started a new corporation called Ardor Labs (site not up yet), which will be mainly focusing on 3d Java technology. I've already got a good amount of work coming in and have started learning new areas of technology in the process; namely, the Eclipse Rich Client Platform and for another project, Project Darkstar. The later has come a long way since I last saw it two years ago and I'm happy to report it can be very performant. I say "can be" mostly because you have to get your mind focused on doing things in such a way as to properly use the technology and that took a little bit of doing for a client side guy like me. :) More on that another time.

I'm also excited that jME development is moving forward again. Recently added to jME 2.0 was JOGL support (by a very dedicated guy named Steve Vaughan who has also been helping with build and source cleanup.) Also recently added was SWT canvas support and support for Fog coordinates (fog being initiated by Kevin Glass.) The fog coordinate support will be interesting for lots of things, one example being fog of war.

A number of others have been very busy in the community and I will try to comment more on that. It's a good time to be a code monkey. :)

Like a Rock Star!



Evidently enough attendees thought we did a good job at our JavaOne '08 tech session to push Rikard and I to Rock Star status.

Don't worry, we won't let it go to our heads... Now where did I put my cape?