A plan to bring Java to iOS

OpenJDK Mobile would use ahead-of-time compilation to create Apple-approved executables that run without the JVM

A plan to bring Java to iOS

A proposal floating in the OpenJDK community seeks to jumpstart Java on Apple’s iOS. The plan involves restarting work on the OpenJDK Mobile project, which is intended to build the OpenJDK classes and API for iOS and Android, said Johan Vos, CTO at mobile developer Gluon.

Vos recently posted a bulletin pertaining to these efforts. OpenJDK Mobile centers on providing the same APIs in the latest version of the OpenJDK source repository to iOS and Android, leveraging tools familiar to Java developers. The first focus, though, is on iOS, which has lacked traditional support for Java. Apple has not allowed the Java Virtual Machine to run on the platform.

The new plan for OpenJDK Mobile would entail using the GraalVM ahead-of-time compiler to compile code at build time. (Vos noted that just-in-time compilation is not an option on iOS.) Compiled Java code could then be linked with native libraries compiled for the target operating system to create executables. This already has been done for iOS, based on Java 11. Using the GraalVM Native Images and OpenJDK classes, developers can create applications that follow Apple rules. Java developers would not have to learn Objective-C or Swift to write software for iOS.

“While Java may be late in the game on mobile, the fact that it is cross-platform, created with security as a key cornerstone, and that it allows for secure connectivity with cloud services, make it a real serious language for mobile development,” Vos said.

Java has been used for Android development from the beginning. However, Android is not Java 11-compliant and requires its own development tool – Android Studio – and procedures, Vos said. Many developers face serious issues using Java projects and libraries on Android, he said.

Also part of the plan is a synchronized fork of the OpenJDK master, which would be created using Project Skara. A Skara-based repository would be leveraged to build OpenJDK for iOS and Android.

Bringing Java to iOS has been the goal of several projects in the past decade. Other efforts included Gluon’s own Eclipse plug-in and the now-defunct RoboVM tool.

Copyright © 2019 IDG Communications, Inc.

How to choose a low-code development platform