Coping with Apple’s Java Policy

Mac OS X 10.6 (Snow Leopard) comes with Java 6. And only Java 6. Want Java 5? Not possible as far as Apple’s Java team is concerned, although there are backdoor methods.

This is mostly a good thing. Java 6 is better than Java 5. It runs faster. It starts up faster. Garbage collection is better. It has new APIs and new methods in existing APIs.

But it’s not all good. Java 6 does not exist for PPC Macs. Some of my Poker Copilot customers are still using Tiger and Leopard on PPC-based Macs. So Poker Copilot must run on Java 5 as well as Java 6.

This makes things somewhat complex. I use Snow Leopard as my main development operating system. I can ensure that I compile in a format usable by Java 5 by using the “-target 1.5” parameter when compiling. But I also have to make sure I don’t use Java 6 APIs or methods.

The solution I have found to this problem is this: to have an automatic build process running on a second-hand PPC Mac Mini running Mac OS X 10.4 (Tiger). When I make changes to Poker Copilot’s source code, I commit them into my Subversion source control repository. TeamCity, an automatic build system, detects the commit, gets the latest source, and tries to build Poker Copilot on Mac OS X 10.4 (Tiger) on a PPC machine. If it works there it will work for all my customers. If it doesn’t work TeamCity notifies of the problem and I can fix it immediately.

This problem must be faced by Objective-C programmers too, because Apple introduces new Cocoa APIs with each OS X upgrade.