Sample Java application:
I'm crossposting my answer from another question here since it is related
and also seems to solve the problem in the question.
Here is my example project with OpenJDK 12, JavaFX 12 and Gradle 5.4
- Opens a JavaFX window with the title "Hello World!"
- Able to build a working runnable distribution zip file (Windows to be tested)
- Able to open and run in IntelliJ without additional configuration
- Able to run from the command line
I hope somebody finds the Github project useful.
Instructions for the Scala case:
Additionally below are instructions that work with the Gradle Scala plugin, but don't seem work with Java. I'm leaving this here in case
somebody else is also using Scala, Gradle and JavaFX.
1) As mentioned in the question, the JavaFX Gradle plugin needs to be set up.
Open JavaFX has detailed documentation on this
2) Additionally you need the the JavaFX SDK for your platform unzipped somewhere.
NOTE: Be sure to scroll down to Latest releases section where JavaFX 12 is (LTS 11 is
first for some reason.)
3) Then, in IntelliJ you go to the File -> Project Structure -> Libraries
, hit the ➕-button and add the lib
folder from the unzipped JavaFX SDK.
For longer instructions with screenshots, check out the excellent Open JavaFX docs for IntelliJ I can't get a deep link working, so select JavaFX and IntelliJ
and then Modular from IDE
from the docs nav. Then scroll down to step 3. Create a library
. Consider checking the other steps too if you are having trouble.
It is difficult to say if this is exactly the same situation as in the original question, but it looked similar enough that I landed here, so I'm adding my experience here to help others.