2

I'm using for the first time JavaFX on Intellij for an university project that requires me to develop a certain program.

I downloaded the 19.0.2.1 version of JavaFX.

Then, i created a new project, and tried to run the HelloApplication file (the one it automatically creates), and it did not build. So, i started following around 10 different guides, so the steps i did were:

  • In 'Project structure', i created a new path to my lib file in the javafxjdk i download before.
  • In 'Edit run configurations', i added this code to the option 'add VM options':
--module-path /Users/User/Download/javafx-sdk-19.0.2.1/lib
--add-modules=javafx.controls,javafx.fxml

  • I also changed the JAVA_HOME variable (i'm on Mac) using this command:
/usr/libexec/java_home

But whenever i run, it gives me this error:

Executing pre-compile tasks...
Running 'before' tasks
Checking sources
Copying resources... [TenthTry]
Parsing java… [TenthTry]
java: module not found: eu.hansolo.fx.countries
java: module not found: eu.hansolo.fx.heatmap
java: module not found: eu.hansolo.toolboxfx
java: module not found: eu.hansolo.toolbox

I have absolutely no clue how i can resolve this. Any help?

Ric97
  • 109
  • 1
  • 6
  • 1
    Assuming you are using the modules listed in the error log in your code somewhere, the `--module-path` option needs to include the path to them. It's almost certainly better to use a dependency management tool such as Maven, and follow the instructions at https://openjfx.io/openjfx-docs/ – James_D Jan 26 '23 at 18:41
  • I didn't use those modules. I did nothing more than create a new project, set everything up following the same guide you provided, building and running the 'hello world' file that intellij creates automatically, and this was the error log. Also, i followed the guide, but for JavaFX. If you say that Maven is better, i'll use that (although i dont really know what's the difference but i'll google it) – Ric97 Jan 26 '23 at 20:20
  • 2
    If you did nothing more than create a new JavaFX project in Idea, then the project would not need the hansolo modules. So you did something else. Use the [idea new project wizard as documented here](https://stackoverflow.com/questions/74764217/error-javafx-runtime-components-are-missing-with-intellij-idea-maven-and-jdk/74764297#74764297). Just use the defaults in the wizard, don’t add any unnecessary libraries. The wizard will create a working modular JavaFX project using Maven as the build tool. You should not download the JavaFX SDK (delete it) or set any VM options for the module path. – jewelsea Jan 27 '23 at 01:35
  • I have the same problem. I installed IDEA, added TornadoFX plugin, created a new project with JavaFX Wizard, compiled and run. Got the messages > Task :compileKotlin e: Module eu.hansolo.toolbox cannot be found in the module graph e: Module eu.hansolo.toolboxfx cannot be found in the module graph e: Module eu.hansolo.fx.heatmap cannot be found in the module graph e: Module eu.hansolo.fx.countries cannot be found in the module graph – ModdyFire Jun 30 '23 at 08:21

3 Answers3

5

I fixed it!

Go to file->project structure->modules and in your modules find those four modules that are throwing an error. change them from "Runtime" to "Compile".

1

My module-info had:

requires eu.hansolo.tilesfx;

I removed it and was able to compile and run the app from the JavaFX9 book.

user16217248
  • 3,119
  • 19
  • 19
  • 37
Tony
  • 31
  • 4
0

Just u need to do one thing, i am trying that for last night 10 pm and still finding the solution. Now I Fixed it u don't need to do anything u just need to do that is create the new Project select javafx give a name to it, and then press next, in that You don't need to add anything among them. Just press continue Button and then if you want to run the default program u will be able to execute the program. And maven settings you have to enable if it is popped up in the bottom right corner. As you error, I was also getting the same error that is not find the hansolo module then I tries this and i got it