Java8 comes with javafx
Open the project in IDEA, File–>Project structure–>SDKs–>18–>Classpath–>+ –> add D:\Java\JDK8\jre\lib\ext\jfxrt.jar
over
The above methods may not work, the most reliable way is to directly replace the SDK with JDK8
p.s. All above is based on this answer from StackOverflow
— Dec 30, 2022