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:
- 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…
- 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.
- 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.
- 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.