Black Magic: Java on the iOS
In an effort to demonstrate just how far the tentacles of their new HTML5 based strategy will reach, Oracle’s Cameron Purdy and Adam Messinger demonstrated the deployment of a cross-platform application, written of course in Java, that would run on Windows based machines, machines running that operating system that shall not be named at any Oracle conference, and finally, to everyone’s delight: iOS.
The Oracle demo application, running on the iPod Touch, wasn’t simply a hubristic attempt to demonstrate the fact that Oracle can now produce applications that run on the Apple platform; it was an attempt to demonstrate that their new strategy going forward will make a ‘write once, run anywhere’ the new reality.
But how did they do it?
The UI was simply written in HTML5, which allows iOS to render the application using native widgets. There’s nothing particularly earth shattering about that. It’s the wiring behind the visual rendering that raises questions.
Java on iOS: Where is the JVM?
The business logic the application was using was all written in Java, and it was running on the iPhone. Adam Messinger described it as “native HTML components from the iOS platform coupled with a JVM.” The UI is HTML5, but the model and controller are all Java. And if the model and controller are all Java, that means there has to be a JVM running in there somewhere.
According to Adam Messinger, “The JVM is actually linked into the program. So the thing that gets download from the app store has a JVM linked into it.” The vernacular Java developers are familiar with is that an application runs on a Java Virtual Machine, not that a program has a JVM linked into it. So, what exactly does this mean?
Is the application essentially like the product of a J++ program, where you would write code and create a Windows executable that runs natively? So you write in Java, but what gets created and compiled isn’t actually bytecode, but instead, native iOS instructions? That would likely get around the roadblocks Apple might put in the way of allowing a Java runtime to be downloaded from the iTunes store. But when demonstrating the application, Adam Messinger indicated that the application was running slow because the Just in Time compiler wasn’t quite working yet, which indicates that the implementation does in fact conform with how we expect Java based applications to behave at runtime.
Will Apple allow it?
It’s certainly exciting to see Java based technology running on iOS. But the nagging worry is that any download that even resembles a Java Virtual Machine will be immediately blocked by the control freaks that run Apple’s app store. If that’s the case, all the efforts of getting Java on iOS will be for naught.