Build and deploy javafx application using java11

humazed picture humazed · Nov 23, 2018 · Viewed 17.9k times · Source

I followed the steps in https://blog.jetbrains.com/idea/2013/03/packaging-javafx-2-applications-in-intellij-idea-121/

but when I try to build artifacts the as in the last step I get this error

enter image description here

Error:Java FX Packager: Can't build artifact - fx:deploy is not available in this JDK

enter image description here

I know JavaFX has been removed from java11 my question is what should I do to build a .jar or .exe

here is a hello world app for quick testing.

Answer

Barosanu240 picture Barosanu240 · Aug 31, 2019

Using the JavafX JAR export option doesn't work anymore in Intelij. You can export it as a regular jar with "Jar-From module with dependencies". This will export a valid Jar, but in order to run it, you need to add your javaFx path and modules to your command.

After you have the jar, the run command should look something like this:

java --module-path PATH_TO_YOUR_JAVAFX_LIB_FOLDER --add-modules javafx.controls,javafx.fxml,javafx.graphics,javafx.web -jar yourJar.jar

I made a youtube tutorial with this: https://youtu.be/HGHu-SzL-5E