display | more...

An API that runs almost in parallel to the Objective C API for OS X.

OS X has the Java 1.3 JVM hardwired into the system which means that pure java applications take on all the interface features of OS X by default.

The Cocoa Java API allows Java programmers to produce OS X only programs but using java to do the coding thus giving all the advantages that java allows such as garbage collection plus all the advantages of using Interface Builder, rather than having to frack about with Swing and the Layout Manager

It's handy for those who know Java and don’t want to learn Objective C, the disadvantages are that not the entire Cocoa API is drawn across into Java land and there are no native archiving classes, which means all java objects get saved as XML objects unless you write your own archiver using JDK classes.

The other good thing is that you can write your core objects in pure java and then layer Cocoa Java objects over the top so your code base is at least partly portable

Some traps for young players exist such as learning to use proxy objects between your data and the interface as the garbage collection mechanism isn't all that it could be and you may find your valuable data hoovered up for no good reason at all.


Six months down the line, I have come to realise that while Cocoa-Java does offer something for experienced Java programmers trying to write for X, it really isn't suitable for developing cutting edge programs for this platform. The main reasons for this are...

  • The JVM doesnt have enough herbs to handle power needy code such as graphics intensive programs.
  • The JVM chews up memory, which isnt so important in a Unix environment but this is a notable issue.
  • Not all of the Cocoa API has been implemented so a lot of things which should come free are really hard to implement.

If you are serious about developing an application for OS X then take the time to learn Objective-C as it will pay off in the long run when your app develops beyond something simple.

On the other hand if you have some rapid prototyping to do in a language you know,then Cocoa-Java could be the thing that you need

Log in or register to write something here or to contact authors.