Last night I was discussing iPhone with my wife and the rather odd decision by Steve Jobs to cut Java out of the iPhone.
My initial thoughts on the iPhone were overwhelmingly positive. My hopes for development on the device were also positive. Then I found out that the iPhone would not be open to third party development. This caused great annoyance on my part.
Then I read last night that Jobs said that Safari on the iPhone would not support Java but might support Flash. His actual words about Java: “Java’s not worth building in. Nobody uses Java anymore. It’s this big heavyweight ball and chain.“ This REALLY got me annoyed. Nobody uses Java? Nearly everybody who has a phone today uses it! I’m using a Motorola SLVR iTunes phone right now as I type this that has a Java CORELet implementation of the iPod interface, written by Apple themselves. When I calmed down a bit I thought about what he was actually saying. He wasn’t talking about the phone specifically, he was talking about the Safari browser within the phone. Safari on the phone will not support Java because, well, he’s right. Java applets in the browser aren’t nearly as common today as they used to be. Average web developers don’t use Java applets much anymore.
But, applets aside, what about the Java2 Micro Edition (J2ME) that we all have on our phones today to play Tetris or read eBooks, or whatever? What about websites where we can download JAR and JAD files for out mobiles? It appears that the iPhone will not participate in that ecosystem. It will go it’s own way, only running Cocoa OS X apps developed and sold/distributed by Apple themselves.
Why? That’s the big question I have been wondering. Why not do all the cool new OS X stuff and ALSO have J2ME?
I think the answer is “the sandbox”. Java apps run in a “sandbox” that limits their access to the hardware they run on. This keeps viruses and malicious code from damaging your system via Java. In order to get outside the sandbox, the apps need to be digitally signed and most Java developers don’t do that. So, it’s inherently safer. Cocoa, the development platform for OS X, has no such sandbox. Cocoa apps can go where they want and do what they want (although User Level security is a limiting factor). For Apple to allow people to develop apps for the iPhone without a managed code model, they would be taking a risk that developers might write insecure and potentially damaging code. Apple is well aware that most people buy new apps for the phones from their phone provider and you can bet that apps will be developed and sold by Apple via iTunes and Cingular and it’s what most people probably would have expected anyhow. The average person doesn’t expand their phone with open-source/free J2ME apps, they buy what Cingular/T-Mobile/Sprint offers them. They don’t care if it’s Java or Cocoa. Only people like me, who want to mod their phones and extend their capabilities without buying stuff from our phone providers are miffed about this.
OK, so Apple wants the system closed because Cocoa is not a managed code language. Why not also support J2ME? Obvious. Apple doesn’t want to sell Java apps, they want to sell Cocoa apps. Only a minority of people get JAR files outside their providers, and the phone providers don’t see any revenue from them anyhow.
Other factors, no doubt, are that Java needs to be licensed (which costs money) and Java support uses memory/resources that Apple would rather put to use in a different way.
Having thought the issue through, I can now understand the rationale behind the decision to close the phone and the decision to leave Java out of it. I don’t like it, but I can see why they did it.
My prediction: somebody will figure out how to get apps on the iPhone “unofficially” and a Java 2 ME system will ultimately be available as an installable Cocoa app to run Java apps, even if putting it on your phone voids your warranty.
We shall see, eh?
