Blog archive

Rebooting OpenJDK Mobile

Is it time to "reboot" the OpenJDK Mobile Project, which focused on porting the JDK to iOS, Android, and the now deceased Windows Mobile? Johan Vox, co-founder of Gluon, a Belgium-based mobile solutions, and a Java Champion, thinks so.

Vox made his case recently for restarting public work on the fallow project on the mobile-dev mailing list. "After a long time, it is a good moment now to restart the public work in the OpenJDK Mobile project," he wrote.

"In the past, we had a repository with code based on OpenJDK 9 that allows [us] to build the class libraries (including native code) and one or more VMs for Android and iOS," he explained. "While this works, we still have the limitation on iOS, where dynamic code is not allowed, hence a JIT is not an option. The Zero VM works there (interpreter mode) but [it] is slow."

Vox's idea is to use the GraalVM AOT compiler to compile the code at build time. The compiled Java code could be linked with native libraries compiled for the target OS and create executables. Most of the VM functionality is provided by a very small set of files in SubstrateVM, he explained, which are linked to via the GraalVM native image.

"We already did this for iOS, based on Java 11," he wrote, referring to the June release by his company of Gluon Client plugins that support Java and JavaFX on iOS devices. "The [difference] to the upstream code is remarkably small."

The Gluon Client plugins, currently in beta, offer configurations for running Java 11+ and Java FX apps on iOS devices or the iPhone simulator. They're designed to allow developers to create iOS and Android apps in Java. Gluon Mobile provides UI control for the client application, handles communication with the server-side cloud and third-party services, and abstracts the platform-specific APIs. Gluon Client tools can generate a native executable for iOS devices.

The OpenJDK Mobile Project was originally set up to manage two different repositories, each with a different set of integration rules. The mobile/jdk9 forest was allowed to contain only the OpenJDK officially approved changeset that had been reviewed as if it were going to be immediately integrated into JDK 9. The mobile/dev repository was designed to be used for integration of features that were not approved for JDK 9 integration, early prototypes, or sharing of early features not yet ready for integration into mobile/jdk9.

For his part, Voss plans to use Project Skara, an alternative SCM and code review tool, to create a "synchronized fork" of the OpenJDK master and to push the changes required to build the native libs for the core libraries.

"Ultimately, it would be ideal if all required changes can go upstream, he wrote. "At this moment, this is iOS only, but there are no showstoppers to do this for Android as well. The architectures are pretty similar."

Posted by John K. Waters on July 10, 2019