This error is display when I try to run my code on IntelliJ . Anybody know how to solve this problem. Thank you a lot for every answer.
Error: JavaFX runtime components are missing, and are required to run this application
You must be signed in to leave a comment
7 October 2022, 03:27
This is a Java FX issue. Everytime they update it you need to go in and manually add the "VM Options". Google how to do this. *alternatively* I find you can start the game from a class that calls the Game classes launch() method from the class that inherits it. SO: - In the MineSweeperGame class create a new static method. Call it anything you want. - In it call MineSweeperGame.launch(). - Create a new class in the minesweeper folder - in this new class make a main() method. Call the custom static method you created in step 1. - run this main() method and the game will launch ***i think its launch(), it may be something else similar to launch()... like start() or begin() look through the available methods and you will find the correct one***
7 October 2022, 20:11
I try alternative options and this is my result: Error occurred during initialization of boot layer java.lang.module.FindException: Error reading module: /Users/michal/Downloads/CodeGymTasks/CodeGymTasks/out/production/8.Games Caused by: java.lang.module.InvalidModuleDescriptorException: Package org.openjfx not found in module I don't understand how works module and this is my first touch with javaFX, so maybe this issue is very simple but I would like to more understand this so this is why I answer.
7 October 2022, 20:13
In first case, my result is: Error occurred during initialization of boot layer java.lang.module.FindException: Module javafx.base not found I use java 18 and I try add the "VM Options" with javaFX19, can this generate this error? Thanks for your answer and help ;)
7 October 2022, 21:56
The easiest way is to install JDK 8. That comes bundled with JavaFX. If you insist on a higher version... goto IntelliJ Project Structure -> modules, chose the Games module and import the JavaFX sdk lib then (after Minsweeper extends Game) right click the lil green arrow and modify the run config -> edit vm - options, add that infamous line (after you changed the path to your actual one) --module-path "path/to/javafx/lib" --add-modules javafx.controls,javafx.fxml
9 October 2022, 14:25
To solve this problem I needed to download javaFX (in my case javaFX19), I added "VM Options" with direct to javaFX19 and modified module-info.java file. After all this I have correctly result only when I run game's class by calling it in another class ( MinesweeperGame.launch() ) . This solution is satisfying me at this time. Thank you very much for help.