JavaFX with Maven


I recently started a JavaFX project, and I'd like to use Maven as my compiler/deployment tool.

Is there a good tutorial or plugin to integrate JavaFX and Maven?

10/13/2010 3:02:20 PM

Starting with Java 7u9 I think JavaFX is shipped together with Java SE runtime and the rest, so it makes it pretty easy to create a Maven-based JavaFX project.

Here is what you do (assuming you have latest Java SE 7 runtime environment):

  1. Go to directory where your JRE libs are installed: cd "/c/Program Files/Java/jre7/lib"

  2. Find what is the version of the JavaFX by reading the file. cat will produce something like: javafx.runtime.version=2.2.3

  3. Now you are ready to install the JavaFX runtime package to Maven: mvn install:install-file -Dfile=jfxrt.jar -DartifactId=javafx -Dpackaging=jar -Dversion=2.2.3

  4. Finally, create a simple Maven project, in say NetBeans, open your pom.xml file and add the following dependency:


Once you save the pom.xml you can continue using your typical Maven workflow.

Please note I used the MSYS ( environment on Windows in the examples above in the case you get confused. If you prefer Windows CMD it would be very much similar. I just do not feel comfortable without BASH and GNU tools such as sed, grep, etc...

2/19/2013 4:04:28 PM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow