Alex headshot

AlBlue’s Blog

Macs, Modularity and More

No Java for iPhone

2008, iphone, java, mac

There's been a depressing amount of 'news' over the last couple of days covering a Sun Marketing Droid thinking it would be a good idea to put Java on the iPhone. This shows you what happens when you get a marketing droid doing technical thinking or not even reading the license agreement:

An Application may not itself install or launch other executable code by any means, including without limitation through the use of a plug-in architecture, calling other frameworks, other APIs or otherwise. No interpreted code may be downloaded and used in an Application except for code that is interpreted and run by Apple's Published APIs and built-in interpreter(s).

Not only that, but Jobs has previously gone on record as saying “ Java’s not worth building in. Nobody uses Java anymore. It’s this big heavyweight ball and chain.” Of course, Jobs' position has changed over time (for example, denying a video iPod and then bringing it out a year later) but the lack of Java on the iPhone (and the rationale behind it) has been well known for a while. In fact, exactly the same arguments about no flash on the iPhone as announced at the shareholder meeting in March 2008.

Even taking the legal arguments out of the equation ... who wants Java on the iPhone anyway? The J2ME (or is it JME?) is still a horrible environment to code for; the LCDUI is unbelievably dated and the only thing that a Java application on a phone can do is drain the battery. If you want bluetooth, access to contacts, mail; program in a different environment. There's a reason why eRCP is becoming a de-facto standard instead of the JME basics; it's extensible and doesn't involve the dead-or-dying JSR in order to do anything useful.

The iPhone SDK on the hand has full access to the iPhone's facilities, including accelerometer, graphics with OpenGL ES (none of this JavaFX bloat) and OpenAL for the audio.

Lastly; the Cocoa APIs on the iPhone correspond closely to the ones on the Mac as well. What this play does is not only open up the iPhone for games; it opens up the Mac for games, too. If your graphics and audio are already OpenGL and OpenAL under the covers, then they'll be compatible with Mac games as well. It's a while away before we see a dedicated Mac-games console (if at all) but one could easily see a combination iPhone/Mac game. The DS Lite already has two screens (one of which is touch sensitive); one is used for the map whilst the other is for the game view. How long is it before an iPhone/Mac game (or indeed, iPod Touch/Mac) is brought to market? View the game on your main screen, but use the iPhone's accelerometer to move the character around. You could even use the iPhone's screen to display the character's vital statistics and choose weaopns etc.

The Mac isn't a dedicated gaming platform yet. But an iPhone+Mac combination is a much more powerful system than a PS3/PSP combination. And none of this needs Java to succeed ...