Apple and Java: Stop Whinging!

Simon Brocklehurst is an interesting blogger who always has something thought-provoking to say. Often I agree with him, sometimes I don’t. Today, I don’t. In his latest post he talks about the frustrations of developing in Java on Mac OS X. Incidentally this is a topic that the JavaPosse like to bang on about as well, and I must say it puzzles me.

I recently switched to a Mac laptop, and before switching I was a little worried about the Java support, having heard rumours about Apple not being very keen on Java. However, on digging a little deeper, I found there wasn’t too much to worry about: my new Mac would come with Java 1.4 installed already, and I could download Java 5 from Apple’s developer website.

That’s already better than a PC, frankly. Last time I checked, Windows didn’t ship with anything that Microsoft was legally entitled to call “Java”. But in fact, when I received my new Mac I was pleasantly surprised to discover that Java 5 was already installed, so I didn’t have to download anything at all (save for Eclipse).

Of course, that’s not enough for some people. They want the latest and (supposedly) greatest: Java 6, with all it’s brilliant new features like… umm… splash screens! And a JavaScript engine bundled right into the JRE so everybody has to have it, rather than just the people who need it! Oh, and some improvements to Swing which are probably only relevant to Windows users. Now don’t get me wrong, Java 6 is a good release, it has some significant performance and stability improvements, but you don’t need a major version number increment just to improve the performance and stability. Unless you happen to work in Marketing. In fact that’s the big problem with Java 6: it’s a marketing-driven release rather than an engineering-driven one.

So why should Apple devote its precious resources to keeping up with largely unnecessary new versions of Java? It should be obvious to anybody that Java is not central to Apple’s strategy: “Write once, run anywhere” is anathema to an O/S vendor that takes pride in the high visual quality and tight integration of applications running on that O/S.

Most niche platform vendors try to lower the risk of developing for their platform by making it as easy as possible to port from other platforms, and Java is a great enabler in that regard. However Apple is different: they try to keep their platform distinctive, and discourage developers from doing anything so unseemly as “porting” applications to the Mac. Ideally applications should be designed explicitly for the Mac, to the exclusion of all other platform. Luxury brands in other industries follow a similar strategy. For example, if you drive a Ferrari, you will find that parts and accessories are gratuitously incompatible and therefore far more expensive. Furthermore, Ferrari drivers go along with the charade — they would be horrified at the thought of sullying their Italian masterpiece with a Korean tyre.

Even more obviously, Java was never core to Microsoft’s strategy. MS hates it for the same reason the niche platform vendors love it: because it offers a way to break the Windows lock-in. Sun recognized this and made its Windows version a first-class citizen, supported directly by Sun. Why doesn’t that happen for Mac OS? Cutting-edge Java support on the Mac is more important to Sun than it is to Apple. If Sun feels the need to make “major” releases of Java every couple of years, then Sun should take on the burden of keeping the Mac OS version up to date with its Windows, Solaris and Linux releases. Alternatively, now Java is open sourced, the subset of Java developers who think Java 6 matters can work on a port themselves. Nobody expects Microsoft to dutifully implement the latest version of Java for Windows when Sun tells them to.

But I digress. Does the lack of Java 6 on Mac OS make it an inferior platform for Java developers? I think not. If I were to develop code with a dependency on Java 6, I would be leaving 80% of my potential users high and dry. Yes, that statistic was plucked out of thin air, but I think it’s a reasonable estimate. If I need a JavaScript engine, I’ll download Rhino. If it turns out that I really, really need a feature of Java 6 that isn’t available as a separate module, then I will give in and introduce that dependency — but I don’t see that being very likely. These days I’m just about willing to start introducing Java 5 dependencies, since I believe it has now passed the 50% penetration mark, and it at least has some interesting features that really couldn’t have been implemented anywhere else except directly in the JRE.

Apple is doing just fine with their support for Java. They should stick to their knitting and make sure Leopard is a stable, high-quality release of Mac OS. If you disagree, that’s fine — why not stop whinging about what Apple is doing, and lend your support to porting OpenJDK?