Alex headshot

AlBlue’s Blog

Macs, Modularity and More

How Apple killed Java

Java 2009 Mac

Despite the potential to benefit Apple more than other operating systems, Java has been a bit of a millstone around Apple's neck for a while. It's sullied Apple's name and caused it much grief from its developers, and to some extent even alienated a few whose Java work is their business. (Worse, none of this is Java's fault – it's all firmly on Apple's doorstep.)

But Apple, whether intentional or otherwise, has managed to kill Java. From its promising early days to shipping Java with every Mac (and making the JavaVM.Frameowrk available to all and sundry), combined with its support for WebObjects and associated Java-developed NSClasses, Apple has now firmly given Java, and by extension Java developers, the boot.

It's actually been a long, drawn-out, slow death rather than a quick-and-easy execution. Let's see where it all started to go wrong:

  • Apple drops support for frameworks in Java Bridge considered legacy. Primarily aimed at a sales tool when WebObjects was being outclassed by heavierweight Java EE application servers, the Java bridge allowed Java developers to take advantage of Mac UI components to build applications. Great idea, and the underlying concept lives on in the form of the Objective-C bridges to Python and Ruby (and even powering the Cocoa port of SWT). However, one of Java's attractions was its run-anywhere model; so on the one hand, the Java purists (100% Java, anyone?) wouldn't touch it with an NSBargePole, whilst people who 'got' Objective-C wrote in that instead. There was a pretty small user base for both of the WebObjects customers, to the extent that WebObjects — once a $50,000+ product in the NeXT days — eventually became free and integrated into Mac OS X itself, and ultimately begat the CoreData API
  • Java 6 released late and only for 64-bit Macs. Despite there only being a handful of 64-bit macs in the wild at the time, Java 6 was previewed in December 2007 and released in March 2008; despite being available since December 2006. Even the preview was a year out of date by the time it happened, and by the time it was released to Apple users, Java developers had already given up in disgust. Of course, the 64-bit only strategy was based on Snow Leopard's 64-bit only support (almost certain to be Intel-only 64-bit support) but unfortunately the OS has been taking the same leisurely pace as its Java 6 cousin.
  • No Java on the iPhone. This was the real killer for Java (though not, as pundits thought, the iPhone). There's actually two angles to this:
    1. Because there's no JVM, applications are compiled 'to the metal'. Difference between execution speed on a good JIT and an equivalent C program have fallen to the wayside on fast GHz systems; but a lower-processor spec item like an iPhone it's more noticable (and probably without a JIT). Doesn't mean it can't work, as googling for JamVM will show you. Of course, the real reason was in application prevention so that Uncle Steve can vette your apps instead of you installing them yourself. But also;
    2. It forced developers to learn Objective-C. Frankly, any language is pretty much like another for the purposes of getting things done, but by making only one of these possible (no python, ruby etc.) ti brought a bunch of developers to the Objective-C kool-ade fountain. And now that they've tried it, in most cases, they realise that they like it. Even things like Garbage Collection have come to the Objective-C stable (though OK, not for the iPhone OS yet) and it was good. The iPhone has been the biggest advertisement for Objective-C than all the macs in the world put together; and people are flocking to the platform. Who cares about other languages when you can support your own?
  • Fanatically dangerously late security patches for Java. The January 2009 update plugged several holes with remote-execution capability from Apple's JVM implementation; and now, we've got much the same problem, except that this one has been known for six months. And yet still no update from Apple. The only sensible thing (other than removing old versions of Java from your Mac) is to disable Java completely. Single-handedly, Apple have managed to turn everyone off of Java by making sure that everyone's got it disabled at the client layer. (Well, not that anyone uses crapplets any more; but a few might use Java WebStart, which is also fingered in the security hole.)

So, Apple has managed to kill off Java on the Mac, mostly through incompetance, slightly through focussing on the 64-bit as an upcoming marketing strategy, and largely through promoting Objective-C via the iPhone. But let's not let our good friends at Sun JAVA Oracle not share some of the blame for the fiasco that is Java's crumbling development model. By tightly welding the JVM, the libraries (as one über-massive turdfest) and naming conventions that have a new naming convention every release, Java has been a monolithic release train heading straight to the scene of the accident for some time. Consider where Java would be on the Mac now if the JVM had been spun off in the 1.2 days, and the libraries had evolved their own paths since? Chances are, a lot of the 'good stuff' (multi-threaded collections, internationalised domain names, ws-death-star implementations etc.) might even be downloadable as 100% pure Java modules. Hey, it works for Python and Ruby and pretty much any OSGi application and Maven ... Sadly, Sun JAVA Oracle lost the plot a long time ago on the whole JVM vs Java compiler vs Java libraries thing. OSGi helps, and the recent revitalisation of the Java modularisation stuff (sorry, JDK7 modularisation stuff) is a good step in the right direction; but it's a bit like bolting the stable after the horse has been put down.

Sadly, Apple's marketing of PCs as being more secure than Windows stand up to little scrutiny, and Java (as an open-source but six-months-behind product) is a vehicle for ramming viruses up where the Sun no longer shines. I expect now they've been publicly embarrassed to respond with a fix; but who knows how many other security holes are lying in wait? Would you even want to find out? Chances are, the next version of Safari will come with Java disabled by default - and then Apple's Java will be dead to all.