Issue
As far too many other people I also have the same problem that the JavaFX modules can't be found by the compiler. First of all I am using Eclipse and added my JavaFX location as a User Library
in Eclipse (like this), added my projects dependencies (like this) and made sure my %PATH_TO_FX%
is set (like this).
After that I added the following arguments to VM Arguments
in Run Configurations
:
--module-path "C:\Program Files\Java\javafx-sdk-13\lib"
--add-modules=javafx.base,javafx.controls,javafx.fxml,javafx.graphics,javafx.media,javafx.swing,javafx.web
Which results in the following message:
Error occurred during initialization of boot layer
java.lang.module.FindException: Module javafx.base not found
I do have a module-info.java
file looking like this:
module MyProject {
opens gui.controller to javafx.fxml;
opens gui to javafx.graphics;
requires transitive javafx.graphics;
requires java.sql;
requires javafx.base;
requires javafx.controls;
requires javafx.fxml;
requires javafx.media;
requires javafx.web;
requires java.desktop;
requires commons.logging;
requires itextpdf;
requires mysql.connector.java;
requires org.json;
}
The complete commandline generated by Eclipse is shown below.
C:\Program Files\Java\jdk-13.0.2\bin\javaw.exe
--module-path "C:\Program Files\Java\javafx-sdk-13\lib"
--add-modules=javafx.base,javafx.controls,javafx.fxml,javafx.graphics,javafx.media,javafx.swing,javafx.web
-Dfile.encoding=Cp1252
-p "D:\Bibliothek\Projekte\Git\MyProject\bin;D:\Bibliothek\Projekte\Git\MyProject\external\commons-logging-1.2.jar;D:\Bibliothek\Projekte\Git\MyProject\external\fontbox-2.0.17.jar;D:\Bibliothek\Projekte\Git\MyProject\external\itextpdf-5.5.13.1.jar;D:\Bibliothek\Projekte\Git\MyProject\external\mysql-connector-java-5.1.47-bin.jar;D:\Bibliothek\Projekte\Git\MyProject\external\pdfbox-2.0.17.jar;D:\Bibliothek\Projekte\Git\MyProject\external\json-20190722.jar"
-m BuechereiSoftware/gui.BuechereiSoftware
Solution
I solved this by not using my custom JavaFX user library as a system library in Eclipse.
You can find this setting under Eclipse > Preferences > Java > Build Path > User Libraries
then edit your JavaFX library and untick System library (added to the boot class path)
. This should now look like this
Answered By - Zoffin
Answer Checked By - Katrina (JavaFixing Volunteer)