S
S
Scorpio2019-03-27 17:57:39
Java
Scorpio, 2019-03-27 17:57:39

Error using javaFX in jdk 11+?

I create a standard JavaFx project, choose jdk-12. Downloaded separately javafx-sdk-12. I connect everything to the project, and intellij immediately sees the imports (before that, it was highlighted in red). But it still doesn't work, why?
Mistake:

/home/topmetaf/Документы/My_JDK/jdk-12/bin/java -javaagent:/home/topmetaf/Документы/Intellij_idie/idea-IU-191.6183.62/lib/idea_rt.jar=36343:/home/topmetaf/Документы/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 I connected javaFX:
5c9b8f3a7839e195548102.png5c9b8f41c995a215519919.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
akimdi, 2019-03-28
@notAquarius

Well, you haven't configured additional JVM options.
To configure them, you need to:
Open the settings and set additional JVM options:
Run -> Edit Configurations -> VM Options: --module-path /usr/share/openjfx/lib --add-modules javafx.controls,javafx.fxml
( in the --module-path parameter, specify the absolute path where your OpenJFX is located, and in the --add-modules parameter, specify which modules you use in this project, for example, I have javafx.controls and javafx.fxml - you specify those that are used by You).
Next, configure:
File -> Project Structure -> Modules -> Dependency tab add ("+" JAR or directories) the lib directory where you have unpacked JavaFX: /usr/share/openjfx/lib
(instead of my path /usr/share/openjfx/lib write your own)
After all options are set, run the project.
As I understand it, you are a novice javaist :)
For example, in the console, this is done very simply:
Download the HelloFX.java example for testing:
Let's compile the JavaFX application:
Launching the JavaFX application:

/usr/lib/jvm/java-11-openjdk-amd64/bin/java --module-path /usr/share/openjfx/lib --add-modules=javafx.controls HelloFX

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question