0

user library[dependencies tab][1]I am trying to make a JavaFX application following the MVC Method. I've created a Main.javafile to launch the application, a controller.java and a view.fxml file.

When I try to launch the application (main file) I get the following error: Error occurred during initialization of boot layer java.lang.module.FindException: Module javafx.controls not found .

I have another project where I copied these three files into, inside the same eclipse IDE, with the same build path and VM arguments, and there it works. The thing is, that I need it inside my project, not the "mock" project where it seems to work. I hope this is not too confusing, so I will add some screenshots.

On the image you can see the package explorer, with the said projects extended. As you can see, both have the same files AND the same Librarys included.

The second image is in order to demonstrate, that both project include the javafx.controls.jar files. Not even my professor was able to help me... Does ANYONE have an idea as to what might be causing this issue? Thanks. [Projects have the same files][1]

the JAVAFX libraries include are IDENTICAL

edit I've added screenshots to show you what my dependencies Tab in the run conigurations include.

11
  • The white X in the red square means that your code contains build (i.e. compile) errors. Open file SpielController.java in the java editor and the lines that contain errors should be marked. Are you using Maven or Gradle or Ant or some other build tool? Commented Dec 17, 2020 at 18:13
  • You need the JavaFX libraries to be available at runtime, not just compile time. So it's not enough to simply "include them in the build path". This question is IntelliJ-specific, but the concepts are the same. Note in particular step 4 in the accepted answer. Commented Dec 17, 2020 at 18:42
  • @Abra I noticed that too. However, the file SpieleController.javais exactly the same in both projects. Commented Dec 17, 2020 at 19:05
  • @James_D sorry for the naive question, but how do I ensure that they're also available at runTime? btw. i think i already did the step 4 correctly --module-path "/Library/Java/JavaVirtualMachines/javafx-sdk-11.0.2/lib" --add-modules=ALL-MODULE-PATH Commented Dec 17, 2020 at 19:14
  • 1
    the file ... is exactly the same in both projects Doesn't change the fact that it is not compiling in one of the projects. Which line[s], in file SpielController.java are not compiling? What error is Eclipse showing you for those lines? Commented Dec 17, 2020 at 19:16

1 Answer 1

2

It appears that the Java Compiler settings for your project are incorrect.

From the Project menu of Eclipse, choose Properties menu item. The project properties window will appear. In that window, select Java Compiler and make sure the compliance level is correct. See below image.

Eclipse project properties

Since you appear to be using JDK 11, I suggest that you set the compliance level to 11.

EDIT

After you fix the compile errors, then you can run your project. In order to run your project, you have to define a run configuration. Select Run Configurations... item from Run menu. Make sure that the JavaFX JAR files appear in the Dependencies tab.

Eclipse run configuration

Sign up to request clarification or add additional context in comments.

3 Comments

Hello Abra, thank you for the answer. I checked the compiler compliance level and it was indeed completely off - 1.5 instead of 11. Changing this, resulted in the disappearance of the error, the project now has no "white cross inside the red box" anymore. However, the error remains Error occurred during initialization of boot layer java.lang.module.FindException: Module javafx.controls not found btw, sorry for the delayed answer.
Hello again. In the dependencies Tab, I have included the libraries aswell. I added two more screenshots to demonstrate this. I have the user Library called javaFx11, which includes the javafx.controls.jarfile
Now they're up.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.