Run/Debug Maven JavaFX 2 in Netbeans

2019-07-12 18:26发布

问题:

I setup a Maven project for a JavaFX 2 application, which uses javafxpackager threw exec-maven-plugin to build a runnable jar. This build process works fine and the application can be started from the commandline.

Does anyone know how to modify nbactions to run and debug this jar from within the IDE?

The command to execute the jar on the commandline is:

java -Djavafx.runtime.path=$JAVAFX_HOME/rt -jar ./target/MyApp.jar

回答1:

The modification it's, for every "action" tag, change the tag as follows:

 <exec.args>-classpath %classpath  -Xbootclasspath/a:"C:/Program Files/Oracle/JavaFX 2.2 SDK/rt/lib/jfxrt.jar"  ${packageClassName}</exec.args>

Of course, change "C:/Program..." to fit your setup.