/ JavaFX / Building JavaFX Applications with Maven

Building JavaFX Applications with Maven

admin on 2012/10/13 - 13:30 in JavaFX

There are already a lot of posts out there that describe a workflow for integrating JavaFX in Maven. Here is one example by Adam Bien: http://www.adam-bien.com/roller/abien/entry/how_to_compile_java_fx

For all this solutions you have to specify your system-specific path to the JavaFX installation. You can set the property inside your Maven pom. This is ok for a single user environment but counterproductive when developing in a team. Another way is to set the property on OS Level. But then every developer have to do this on every workstation.

Since Java 7 update 6 JavaFX 2.2 is bundled  in the JRE. You can find JavaFX at JAVAHOME/lib/jfxrt.jar. Since Maven 3 you can access the < code >JAVAHOME path with the < code >${java.home} property. With this informations you are able to create a system independent pom-file:

The solution is working since Java 7u6. If you have different JDKs / JREs installed on your system you have to start Maven with the right JDK. The pom also works in Eclipse with m2eclipse-plugin. Here you must ensure that Eclipse is started with Java 7u6+.


Send Us A Message Here

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