A
A
artem2020-12-08 23:00:10
JavaFX
artem, 2020-12-08 23:00:10

JavaFX runtime components are missing?

I really don’t know what, I did everything as requested in the documentation.
5fcfdab4ae481995591402.png5fcfdab9c1e5e851141567.png
In intellij idea, everything works, it does not launch the jar file through the console, through a double click either.
I went through all the articles.

jar created correctly, through the main class.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Alexandrov, 2020-12-09
@arteqrt

The catch is that javafx has become a module and the module system itself works a little differently.
Actually, earlier in java8 it was like this:

  • built the jar and run it with the command "java -jar filename.jar"
  • if there are dependent libraries then so "java -cp dependent_libraries.jar -jar filename.jar"
  • you can build fatjar. Here, when building your jar, the dependencies are placed inside your jar. Running like this "java -jar filename.jar"

The problem of dependencies is related to the fact that they drag the entire library with them.
With the advent of java9 and newer, modules have come that essentially "should" replace the old dependency system and the problem of dragging unnecessary code into libraries.
Now so, but keep in mind that there are pitfalls here. both the old and the new systems work and may even overlap. For example, you can build your jar as a module or the old-fashioned "stupid jar"
  • if the program does not take any modules, then you can do it the old fashioned way "java -jar filename.jar"
  • if the program itself is built as a module "java --module-path "path\to\directory\with\module\program" --add-modules your.program's.module.name -m your.program's.module.name/name. main.class"
  • if there are other dependent modules, then everything is exactly as in the previous paragraph
  • can also be built by fatjar as in java8

You need to run it like this "java --module-path "on the last screen, your path is" --add-modules javafx.controls,javafx.fxml -jar filename.jar -m module.name.of.your.program/name.main .class".
This is very superficial and extremely brief. In general, the module system assumes that you no longer have to ship your program as a jar, but must build a self-contained program. Those. compilers have utilities to pack your program along with all the necessary modules and jre, the user just runs it without installing jre\javafx\heaps of libraries.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question