Nicolas Frankel is an IT consultant with 10 years experience in Java / JEE environments. He likes his job so much he writes technical articles on his blog and reviews technical books in his spare time. He also tries to find other geeks like him in universities, as a part-time lecturer. Nicolas is a DZone MVB and is not an employee of DZone and has posted 228 posts at DZone. You can read more from them at their website. View Full User Profile

Spreading some JavaFX love

11.25.2013
| 5607 views |
  • submit to reddit
I’m not a big fan of JavaFX: version 1 was just a huge failure, and investing in fat-client architecture in 2013 is either because you have very specific needs or are completely out of your mind. Nevertheless, I wanted to write about fat-client testing in “Integration testing from the trenches”, and JavaFX is the Java way for fat-client GUI.

So I was searching for some easily available application I could take as an example when I stumbled upon the Ensemble samples project from Oracle itself. Sources are available so I thought this could be a good match. Nothing could be further from the truth, the project is plagued by pitfalls:

  1. It seems the good people at Oracle had to choose between promoting NetBeans and JavaFX and their priority was on the former. Sources are available in NetBeans format. Tough luck if you don’t use it as your IDE…
  2. NetBeans uses Ant as its underlying build tool. Not only are Java sources and binary resources stored in the same directories, you have to read carefully through the build file to tweak some things.
  3. The code itself distinguishes between running from sources or from JAR. In the former case, it uses a text file listing all the desired samples to include, but it is built by the Ant build, and if it’s not present (or empty), you get a not-so-nice NullPointerException.
  4. Even worse, though JavaFX runtime is included in JRE 7, it isn’t on the classpath.

I think that putting such obstacles in the way of developers is hardly the thing to do to promote a technology. In order to fix those problems, I decided to tackle this heads-on, so I’ve created a Maven project. I changed no code, just moved resources around to adapt to the Maven standard project structure and provided the required text file.

The whole project is on Github, you’re welcome to give it a try!http://blog.frankel.ch/spreading-some-javafx-love

 

Published at DZone with permission of Nicolas Frankel, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Tags: