JVM Advent

The JVM Programming Advent Calendar

JavaFX – Not Dead Yet (aka. The Definitive Guide to Modern Java Clients with JavaFX)

We had a few candidate names that we came up with for our new JavaFX book with our publisher. My personal favorite was “JavaFX – Not Dead Yet.” which I think pretty accurately describes how a lot of us long time JavaFX fans feel, but our publisher preferred our secondary option of “The Definitive Guide to Modern Java Clients with JavaFX.” While not a bad title, this clearly doesn’t pack the same punch. (Which do you think makes a better book cover?)

Many folks assume that client Java is dead; however, JavaFX is still alive and well with more usage, more platforms, and more community support than ever. And here are the top 3 reasons you may also want to consider adopting JavaFX for your next client application:

  1. Cross Platform and Mobile
  2. Seamless Native Packaging
  3. Huge Community of Developers

Cross Platform and Mobile

JavaFX has always been a cross platform framework that runs on Mac OS X, Windows, and Linux equally well. However, it now also extends that support to Android and iOS with technologies like JavaFX Ports and Gluon Mobile.

Gluon Mobile is a framework for writing, compiling, and packaging JavaFX applications for deployment to iOS and Android. To the end user your application looks and behaves exactly like a native application.

This was always the dream for Java client developers and thanks to modern cross compilation technology is now something that is easy to do. In fact, you may already have some JavaFX apps installed on your phone like the very popular Devoxx conference application used for the global technology series started by Stephan Janssen.

Seamless Native Packaging

One of the things that has held Java client technology back historically is the challenge with reliably distributing applications. Browsers have never been a friendly place for embedded content causing issues with distribution as Applets and Web Start (although Karakun has been fixing the former as Hendrik described in his earlier Java Advent Calendar post).

A much more reliable way to package Java applications is to simply bundle the Java runtime with your application and distribute it as a native application. This removes any dependencies on the version of Java installed by the end user making it much easier to test your application and validate that your install will work reliably. Also, thanks to modularity, introduced in Java 9, you can ship a minimal subset of the JRE including only the components that are utilizing to minimize your application size.

There are a couple different options for native packaging:

  1. jpackage – Java 14 will re-introduce the jpackage tool that provides a simple way to package your application and all dependencies on the command line. This is already available for in a developer preview here.
  2. GraalVM – GraalVM is a high performance Java runtime that also provides ahead-of-time compilation for Java applications. This allows you to pre-compile your Java application as a native binary with very quick startup times. Gluon has more details on how to do this here.

The end result for your user is a simple native installer that will work regardless of what other Java runtimes or applications they may have installed. In fact, they probably won’t even know you are developing your client application in JavaFX under the hood.

Huge Community of Developers

The great thing about writing applications in JavaFX is that you can tap into the 10 million developer globally who already know how to write robust, enterprise-ready Java code. This means there is a huge pool of available talent who can write and maintain the user interface, likely including you (the reader) as well.

Also, there is a huge, thriving community around JavaFX, many of whom contributed to the aforementioned JavaFX book that we just released. Some of the folks who you should follow on Twitter and can count on to give great advice about Java client development include:

Hopefully you are inspired to build your next client application in JavaFX. If you need help, feel free to reach out to me and my co-authors, or the myriad of other JavaFX experts in the Java community who would love to help.

Author: Stephen Chin

Next Post

Previous Post

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

© 2024 JVM Advent | Powered by steinhauer.software Logosteinhauer.software

Theme by Anders Norén