Building JavaFX Applications with Maven


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:

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 JAVAHOME path with the ${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+.

Hendrik Ebbers

Hendrik Ebbers is the founder of Open Elements. He is a Java champion, a member of JSR expert groups and a JavaOne rockstar. Hendrik is a member of the Eclipse JakartaEE working group (WG) and the Eclipse Adoptium WG. In addition, Hendrik Ebbers is a member of the Board of Directors of the Eclipse Foundation.

Circle Circle

Open Source made right


Privacy Policy Cookie Policy Privacy Config Impressum