Write Once, Read Anywhere with Gluon


“Write Once, Run Anywhere” is a phrase many Java programmers are familiar with. The slogan conveys the cross-platform benefits of Java.

Java code is compiled into machine-independent bytecode, so it can be run consistently on different platforms. You’ve probably seen Java programs run in your web browser, on your PC, phone, or some other device. The Write Once, Run Anywhere concept makes building apps effortless—Programmers need not worry much about the various platforms on which an app runs.

Gluon Mobile gives Java programmers the ability to develop apps for the Android and iOS (iPhone and iPad) platforms without a lag in performance.

In addition, you can develop for the desktop and embedded devices like Raspberry Pi, and this is all done from the same codebase. This means you don’t have to have any prior knowledge of Swift or Objective-C coding (in the case of iOS), as everything will be written in Java and JavaFX. (Yes, amazing!)

JavaFX makes it easier to quickly develop apps. With the JavaFX framework, you have access to various powerful features such as properties, binding, and listeners, which reduce the amount of code you write. Scene builder and FXML also speed up development and give you more flexibility in designing your user interface. Another plus is that you get to use Java 8 features, which otherwise would have been a problem in Android. Gluon provides other solutions to make app development easier. CloudLink, for instance, makes cloud integration less of a pain.

Let’s Give It a Try

Gluon claims you should build software and not have to fight your IDE. They provide a free plugin for the major IDEs like NetBeans, IntelliJ IDEA, and Eclipse. For this post, I will only use NetBeans. The plugin can be obtained from the various IDE plugin centers by searching for gluon plugin. Installing it should create a Gluon entry in the IDE projects section: Gluon Desktop (FXML, Single, and Multiple Views) and Gluon Mobile (FXML, Glisten, Single, and Multiple Views).

For our purpose, we’ll go with Gluon Mobile FXML. We’ll provide an email since we don’t have a Mobile or Desktop license key. Now, check all except the embedded platform and proceed to finish. Disregard any error warnings—It takes some time to download the necessary JAR files.

This should create a basic message that displays “Hello JavaFX Universe!” when the button is clicked. Always close the prompt screen that appears at every startup. (If you enter a license key, this should completely disappear.)

Run on Android

To run the app on your Android device, you need to have it connected, and have media device and USB debugging enabled. In addition, you need to download the Android SDK and add the path to the SDK, to the project’s build.gradle under jfxmobile.android.

 androidSdk = ''

Right-click on the project, select Tasks, and click on androidInstall under Android. With the Android device connected, this should begin installing the app on your device. Once installed, you can see the app in your app center.

You can use it like any other Android app without noticing any difference in performance. For iOS, XCode is required to run the app.


Using Java and JavaFX to develop apps that run on the two major mobile platforms eases the burden on programmers in writing and maintaining code for both. For personal projects, the free version of Gluon will suffice. On the other hand, bigger projects will require a license, which comes with a fee. Nonetheless, Gluon is a framework worth using for many projects and demonstrates Java’s cross-platform advantages.

Bruno is a junior at Ashesi University College studying Computer Science. He is interested in leveraging the power of technology to increase productivity. As a big fan of open source technology, he is currently exploring the possibility of using the Bitcoin Blockchain to fight corruption in government. Bruno is a regular contributor at Fixate IO.


Leave a Comment

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

Skip to toolbar