The Ultimate Business Machine - Archives
List of Categories : Database * Technology * Commentary * Singapore * Travel *
Mon 06 Oct 2003
Java and Cocoa
Category : Technology/javacocoa.txt
My colleague, Hai Hwee, just found an answer as to why simply opening and closing windows will eventually crash an application written in Java that uses Apple's Cocoa framework for creating the user-interface.
It's got to do with "garbage collection". Java has automatic garbage collection that will reclaim memory that is not in use. But garbage collection needs to be explicitly specified in Objective-C, which is the language Apple used to build Cocoa.
I've often wondered how you use these two conflicting schemes together. The answer is : you get crashes - unless you manage it in some way. Now we know why, the crashes have stopped and we're happy coding again.
So the bottomline is: it's really possible to create "native" OS X applications using Java. There are tons of stuff in Java out there for which the cource code is available. And there are a whole lot more Java programmers than Objective-C programmers. This is one religious argument for which I will gladly take the side of the pragmatists. So, Java is it, for us. It brings the Mac back to the mainstream and every little thing helps, if you want to see the Mac accepted by the enterprise market.