Investigating Java on iOS

Investigated how well Java runs on iOS. The answer is - it runs. But it seems like there are issues. I enumerate them below.

Static Linking vs VM

Static Linked Library Some tools basically just translate Java into Object-C and run it. There isn’t a true JVM though but stuff works. This actually works well with iOS because it doesn’t have a VM model and uses reference counting not memory management.
JVM Lite Other tools actually have an Object-C version of the JVM that has a true memory manager and runs Java byte codes. In effect these mini-JVMs are statically linked into a native iOS app.

Native Ux vs a UX Framework

Native UX Some Java on iOS tools provide direct access to the Object-C UX interfaces either through JNI or through wrappers. But the point is that your UX can be written in Java but would only run on iOS.
UX Framework Some tools offer their own UX framework that is intended to automatically map itself to different platforms. The idea is that you write in the UX framework and the tool handles making it look native. But then you are tied to that tool’s UX framework.

Variable JDK Support

Everyone has a different subset of the JDK they support. So which Java JARs, for example, that you could re-use is going to depend on which tool you pick.

Statically Linked Java

JEP 178 (a proposed standard in the JCP) would make it possible to package up the JVM and all its dependencies into a library that could be statically linked to native code in a standardized (and hopefully) portable way. This is extremely interesting because it provides a model for how Java could be moved around just about anywhere, not just iOS. You wouldn’t need to install a JDK. Instead Java would statically link in everything it needed to run creating a completely self contained package. In a sense the existing tools already do this but JEP 178 would standardize the behavior.

Conclusion

The situation with getting Java running on iOS reminds me strongly of the mess with getting Java on Android. Android != Java. They translate. So some stuff works well. Other stuff doesn’t work at all. Similar to Java on iOS. Except Java on iOS is at an every earlier stage than Java on Android is.

Further Resources

This article provides the best short summary of all the major open source Java on iOS tools. And there is Oracle's Application Development Framework.

Leave a Reply

Your email address will not be published. Required fields are marked *