adam bien's blog

Running JavaFX On Mobile Devices With Gluon And Afterburner 📎

Johan, could you please briefly introduce yourself? Why do you like JavaFX?

I am a Java developer, working with Java since it was released. From day 1, I was interested in running Java on small devices. When Enterprise Java started to become popular, my interest moved into combining the world of the small devices with the world of the large back-end systems. Today, that translates into combining JavaFX on embedded, mobile and desktop with Java EE and Cloud systems.

I think JavaFX is important to many Java Enterprise developers. At this moment, many Java Enterprise developers are using a framework to create web pages, based on the business functionality they have to provide. However, there is a clear evolution towards mobile. People and also companies are today rather using mobile devices (phones and tablets) instead of desktops and laptops to do their job.
On mobile, native apps are much more valued than sites that are viewed via a web browser. Hence, most of the business transactions in the future will start from native mobile applications.
Good enough, JavaFX is a perfect platform for writing native mobile applications. And that is great news for all those Java Enterprise developers! They can use their favorite Java language, and still address the future (mobile) needs of their customers. Moreover, thanks to the cross-platform functionality of JavaFX, their client application works on all mobile devices. There is no need to write different versions of the business logic, but there is also no need to write different versions of the user interface. It is really easy to create and to maintain a JavaFX client application that is truly and completely cross-platform.

You ported afteburner.fx to mobile. Was it hard?

No, that was easy. Afterburner.fx is well-structured and uses a few classes only. Also, JavaFX 8 on mobile supports almost the entire JavaFX 8 API. Since JavaFX applications currently run on top of Dalvik, though, we can not use the Stream API's and I had to replace those Java 8 API's with Java 7 API's.

How did you find afterburner? Why do you decided to use it?

There are a number of ideas on how to use enterprise functionality in JavaFX and it is not easy to find the perfect balance between known and trusted enterprise patterns on one side, and client restrictions on the other side. In general, I think developers have to realize that even though client CPU's might be very performant, there are still huge differences between server environments (in a cloud or dedicated datacenter) and client systems.
Afterburner provides an excellent mix, as it allows for Injection to be used, without the need of a complex framework. It is probably the simplest yet functional MVP framework for JavaFX. For server-side projects, I'm always very cautious to not include external dependencies that are not really needed. On the client, I'm even more careful about this.
The Afterburner framework is very small, but it can easily be extended for specific needs. This is important on clients in general, and mobile clients in particular.

What is gluonhq.com? How afterburner is related to gluonhq.com?

I earlier said that JavaFX provides an excellent platform for Java developers to create Java clients applications that work on all kinds of client, and that provide the business functionality that in the past would exclusively be offered via a web interface. While JavaFX is really great, there are a number of issues Java Enterprise developers will probably encounter. With Gluon, we are trying to fill this gap.
Gluon provides products and services for Java Client development. Our tools extend the JavaFX functionality, and bring it to the world of mobile clients as well. JavaFX, which essentially is the standard Java Component for Java on the Client, provides a great set of API's for creating and managing user interfaces. The Gluon products extend this functionality in two directions:

  • With Charm, our client library, it becomes easy to create compelling user interfaces that look excellent on mobile devices, as Charm provides a Material Design look and feel. Also, Charm provides the client API to synchronize data across clients, and to store data remotely in a JavaFX friendly way (by leveraging concepts as Observable, and taking into account the Threading issues that might occur in a JavaFX application)
  • With Gluon Cloud, we manage the data that needs to be stored or synchronized. Gluon Cloud connects client devices with each other, with its persistent storage, or with customer-specific enterprise systems or cloud providers.

What was your coolest Java EE project?

That is a very difficult question, as Enterprise Java changed considerable over the past years. Today, Java EE development is much smoother and easy than it used to be. I do remember we did a large scale voting application in 2010, with thousands of concurrent users. This was our first large-scale deployment of GlassFish on Amazon EC2 infrastructure. It was really exciting to watch Google Analytics Real-Time and see how the number of concurrent users went up while the 2 GlassFish instances were holding fine.

What was your coolest Java FX project?

We have a number of really cool customer projects that I am not allowed to discuss, unfortunately. Apart from the Gluon products we are developing, we have this nice kiosk application we created for CultuurNet Vlaanderen. We run a JavaFX application on an embedded device with an NFC reader, and when people swipe their card, we send this to a back-end. The monitoring of these devices is also done by a JavaFX application we created.
We have a number of similar, form-based applications that we are working on for customers that want to use mobile devices for their employees.
Another cool project we are currently working on, is based on OpenMapFX. For a customer, we provide location-based functionality on top of the geo-maps that are rendered by OpenMapFX.

Any resources, links, ideas you can share with us?

I really recommend Java Enterprise developers to create a simple mobile JavaFX Application, and connect that to their backend system. Gluon currently provides plugins for NetBeans and IntelliJ to make this JavaFX development really easy -- see http://docs.gluonhq.com/charm/latest/#_ide_plugins for more information.
Developers that are interested in creating JavaFX Applications on mobile should have a look at javafxports.org.
People can find everything on Gluon on our website gluonhq.com. Keep an eye on our news section, as we are constantly announcing new stuff.

Johan, thank you for the interview!