Note: Click here to see how to install the last Java version on Ubuntu
If you try to export a JavaFX project to a .jar file according to many tutorials you find online, you might be getting the error Can not build artifact - fx: deploy is not available in this JDK
. If you haven’t tried it yet, good for you, this post might save you a hell lot of time. Note, I am writing this in April 2020, things might change again in the future. So if this method doesn’t work, kindly leave a comment and let me know.
To solve this, follow these steps:
java --module-path [Path to your JavaFX lib folder] --add-modules javafx.controls,javafx.fxml -jar [Your .jar file]
Note: Make sure to include all modules required by your project. Also make sure that your default java version matches the version used by IntelliJ.