Java on iOS, for real.


It has always been our goal to provide first class Java and JavaFX support for all client devices, not only for desktops but also for mobile and embedded devices. Today, we are thrilled to announce that the Gluon Client plugins which we announced last month now have beta support for Java and JavaFX on iOS. The Gluon Client plugins are now extended with configurations that allow your Java 11+ application to run on iOS devices and the iPhone Simulator.

The flow between a Java client application and a native application running on iOS is shown in the diagram below.

The Gluon Client tools are in the center of this diagram. They take the Java application and its dependencies as input. By default, you can run these client applications on desktop and laptop systems, on the supported platforms (Windows, MacOSX, Linux). But you can also use the very same Gluon Client tools for generating a native executable for MacOSX and for iPhone/iPad devices or the iPhone Simulator.

In order to generate native executables, the Gluon Client tools pull in a number of projects:

  • The OpenJDK core libraries, built for the target platform (e.g. iOS) as native static libraries.
  • The OpenJFX artifacts, built for the target platform (e.g. iOS) with Java code and native static libraries
  • The GraalVM Community Edition, including Graal Native which provides a small embedded runtime and compiles the Java code into native code for the target platform.
  • Upgrading from the javafxmobile plugin

    Gradually, the new, uniform Gluon Client plugin will replace the existing javafxmobile plugin. While the javafxmobile plugin was targeting mobile systems only, the Gluon Client plugin is targeting desktop, mobile and embedded systems. We realize there is a big time gap between the previous system and the current system, but there are very good reasons. We don’t want to run mobile apps using anything less than the standard Java. Hence, a full alignment with the core Java code developed in the OpenJDK project has been one of the key requirements for this project. The same goes for JavaFX. In the past, the mobile ports of JavaFX always lagged behind the desktop ports. This is no longer the case, the mobile JavaFX artifacts can be built from the latest JavaFX sources in OpenJFX. Since we are now using a standard Java platform for mobile development, deploying JavaFX code is much more straightforward than in the past, where we had to deal with non-fully compliant Java solutions.
    Finally, rather than developing our own AOT compiler to translate Java bytecode to native code, we bundled forces with the GraalVM team in the Oracle Labs. The same compiler that is now powering a number of projects like Quarkus, Helidon, Twitter projects and a number of serverless projects is the one that we use for compiling to iOS. We worked together with the GraalVM team to realize the last (but long) mile to supporting iOS devices.
    For now, the existing javafxmobile plugin is still the preferred way to create mobile apps targeting iOS and Android. In the near future, we will provide migration instructions that will help you convert existing Java projects.

    The shoulders of the giants

    As already said, we leverage a number of existing great projects. This has a number of advantages. We can benefit from the excellent quality from these projects, and we directly use new features from the upstream projects — be it OpenJDK, OpenJFX, or GraalVM. As good Open Source ecosystem citizens, this also require us to give back to the projects we benefit from. Hence, rather than going for quick, short-term wins, we aim to improve the upstream projects, and then benefit from this. This means that if we want to improve something in the end-to-end chain, that we will always see if the improvement can be done in one of the upstream projects. Doing so, we avoid a divergence between Java on server/desktop and Java on mobile. For decades, Java on mobile and Java on desktop/server haven’t been closer aligned than today, and we want to keep this strong connection.

    Gluon Mobile

    We updated Gluon Mobile so that it works with Java 11 and beyond, and with the new Gluon Client plugin. Using Gluon Mobile allows you to create real mobile-looking applications using pure Java code. If you’re interested, read more about Gluon Mobile. Gluon Mobile customers will be able to use the Gluon Mobile functionality with the Gluon Client plugin, and they will get additional perks. We will provide more information later.

    Get started

    As said, this is currently beta-software, under heavy development. Until today, our main focus has been to align the mobile development with the developments in OpenJDK, OpenJFX and GraalVM. There is much more work remaining related to tools, build performance, configuration,… Having said that, we encourage early adaptors to try out the samples, and build a few apps on iOS devices. Make sure to use the issue tracker for the Gradle plugin or the Maven plugin to provide us with feedback!

    If you have questions, you can contact us.