Error using javaFX in jdk 11+?

Create a standard JavaFx project, select jdk-12. Downloaded separately javafx-sdk-12. Connect all to the project, and intellij can immediately see imports ( previously highlighted in red) . But it's still not working, what is the reason?

Error:
/home/topmetaf/Documents/My_JDK/jdk-12/bin/java -javaagent:/home/topmetaf/Dokumenty/Intellij_idie/idea-IU-191.6183.62/lib/idea_rt.jar=36343:/home/topmetaf/Dokumenty/Intellij_idie/idea-IU-191.6183.62/bin-Dfile.encoding=UTF-8 -classpath /home/topmetaf/Документы/Intellij_idie/untitled4/out/production/untitled4:/home/topmetaf/Документы/My_JDK/javafx-sdk-12/lib/javafx.base.jar:/home/topmetaf/Документы/My_JDK/javafx-sdk-12/lib/javafx.fxml.jar:/home/topmetaf/Документы/My_JDK/javafx-sdk-12/lib/javafx.controls.jar:/home/topmetaf/Документы/My_JDK/javafx-sdk-12/lib/javafx-swt.jar:/home/topmetaf/Документы/My_JDK/javafx-sdk-12/lib/javafx.media.jar:/home/topmetaf/Документы/My_JDK/javafx-sdk-12/lib/javafx.graphics.jar:/home/topmetaf/Документы/My_JDK/javafx-sdk-12/lib/javafx.swing.jar:/home/topmetaf/Документы/My_JDK/javafx-sdk-12/lib/javafx.web.jar sample.Main

Error: JavaFX runtime components are missing, and are required to run this application

Process finished with exit code 1


How do I connect javaFX:
5c9b8f3a7839e195548102.png5c9b8f41c995a215519919.png
March 19th 20 at 08:52
1 answer
March 19th 20 at 08:54
Solution
Well, You don't have set additional JVM options.
What would they need to set:

Open settings and specify additional JVM options:
Run -> Edit Configurations -> VM Options: --module-path /usr/share/openjfx/lib --add-modules javafx.controls,javafx.fxml

(the option --module-path specify the absolute path where Your OpenJFX, but in the parameter --add-modules specify what modules You are using in this project, my example is javafx.controls and javafx.fxml You indicate those You have used).

Further customizable:
File -> Project Structure -> Modules -> Dependency tab add ("+" directories or JAR) to the lib directory where you have unpacked JavaFX: /usr/share/openjfx/lib

(instead of my /usr/share/openjfx/lib write your own)

After all options are set, run the project.

I understand You are a beginner gavest :)
My advice, learn how to work in the console, then work in the IDE You will be given easy.

Here, for example, in the console it is very simple:

Downloadable example HelloFX.java to check:
wget https://raw.githubusercontent.com/openjfx/samples/master/HelloFX/CLI/hellofx/HelloFX.java


Compile a JavaFX application:
/usr/lib/jvm/java-11-openjdk-amd64/bin/javac --module-path /usr/share/openjfx/lib --add-modules=javafx.controls HelloFX.java


Launching a JavaFX application:
/usr/lib/jvm/java-11-openjdk-amd64/bin/java --module-path /usr/share/openjfx/lib --add-modules=javafx.controls HelloFX
Yes, thank you, I have it all figured out, everything works. Noted your reply with decision.
And I still have a question, in fact, because I do connect some third-party libraries, I can do it with maven? - maximillia92 commented on March 19th 20 at 08:57
@maximillia92, of course you can :) And with Maven and using Gradle. But that would have been too boring, I'll give a link to the repository where it already everything is all chewed and painted on the shelves :)
And next, in the IDE folder and then the folder in IntelliJ and choose what You need depending on Your needs. Good luck :) - samara_Lesch commented on March 19th 20 at 09:00

Find more questions by tags JavaFXJava