BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Java on iOS and Android via Gluon

Java on iOS and Android via Gluon

Lire ce contenu en français

Bookmarks

Gluon has released beta support that enables JavaFX applications to run the same code across PC, Mac, iOS, and Android. As a result, developers can use a language and tools that they already know, managing one codebase per application instead of per device.

The toolchain expands on work done in 2015 by José Perada and Bruno Borges who produced a JavaFX game for Android called 2048FX. Gluon has also pushed for mobile Java since Java 9. For running on iOS, Gluon's suite of tools includes a few notable aspects that are automated through a build pipeline:

  • OpenJDK libraries are brought in as static libraries compiled for the target platform.
  • OpenJFX is the graphical framework for user interaction, available for all target platforms.
  • GraalVM in native mode provides the key runtime that is built for the target platform.

When combined through the javafxmobile plugin, the end result for iOS and Android is a native application in binary form. Unlike a typical Java application on a desktop or server, the iOS and Android applications are completely Ahead of Time (AOT) compiled, native, and do not use bytecode or Just In Time (JIT) compilation.

AOT compilation is used to provide direct access to the device and faster startup time. For server-based applications, Andrew Dinn has a technical analysis of why AOT is not necessarily faster than JIT. They are each options, and within Gluon’s stack, the choices favor AOT.

Gluon’s new release comes approximately two years after Shai Almog, CEO of Codename One, stated that "Gluon is dead as RoboVM is." RoboVM was a similar project that ran JavaFX across mobile. That claim follows a similar path where technologists and reporters have made careers out of claiming that Java is dead (it isn’t). In 2016, Redmonk identified that saying "Java is dead," is dead. Almog’s second claim regarding RoboVM was partially correct, as RoboVM was acquired by Xamarin, who was acquired by Microsoft, and integrated into the Visual Studio stack. While names have changed, the documentation and materials remain available.

Developers looking to build JavaFX applications for iOS can consult Gluon’s documentation. A separate tool, SceneBuilder, can be used to help design a user interface that will run across each platform. Visual libraries are available through many channels, where Jonathan Giles periodically aggregates and reports on JavaFX activity. Giles is the author of major libraries ControlsFX and Scenic View. ControlsFX is a suite of interactive visual components, and Scenic View is an analyzer that helps inspect running graphical layouts.

Rate this Article

Adoption
Style

BT