openjfx-docs
openjfx-docs copied to clipboard
Module not found error
I am using IntelliJ 2019.2.3, I set my PATH_TO_FX to C:\Program Files\Java\javafx-sdk-13.0.1, my VM options to --module-path ${PATH_TO_FX} --add-modules javafx.controls,javafx.fxml, my library for javafx 13 has been added under project settings, and I am still getting the error message "Error occurred during initialization of boot layer java.lang.module.FindException: Module javafx.base not found" I'm not sure if I am missing anything. Please help.
PATH_TO_FX should be pointing to the lib folder. In your case it should be C:\Program Files\Java\javafx-sdk-13.0.1\lib
I have the same bug When I search for my path in windows explorer it brings me to correct folders that contains javafx.base
@avacadoadam %PATH% and %PATH_TO_FX% are two different environmental variables; make sure you aren't getting confused between the two. If you want to be sure this is a bug, just hard code your module-path to your javafx-sdk-13.01\lib folder.
Below is a batch script with the hardcoded pathing. You can just copy and paste the below in a .bat file in the same directory containing HelloFX.java. Should run without any issues (assuming you have Java 13 installed).
javac --module-path "C:\Program Files\Java\javafx-sdk-13.0.1\lib" --add-modules javafx.controls HelloFX.java
java --module-path "C:\Program Files\Java\javafx-sdk-13.0.1\lib" --add-modules javafx.controls HelloFX
I had this same problem in Netbeans 11.2, even after having correctly set the VM options for Run in project properties to set the correct modules path.
The solution for me was to turn off 'Compile on Save', as mentioned in this reply to this closed issue https://github.com/openjfx/openjfx-docs/issues/91#issuecomment-537354974
Might be good to add to the docs?
I am facing the same issue. I am using IDEA IntelliJ 2019.1.5 on Ubuntu 18.04. When I set PATH_TO_FX correctly to my local JFXdirectory/lib folder, I am facing the error below:
Error occurred during initialization of boot layer
java.lang.module.FindException: Module javafx.base not found
Facing the same issue in Windows10, Intellij IDEA version 2020.2
Output -
Error occurred during initialization of boot layer java.lang.module.FindException: Module javafx.base not found
Tried all ways, also added this folder to both PATH Variable and VM options javafx-sdk-11.0.2\lib
Still, no clue how to solve this.
Same problem as above. No clue what to do.
--module-path="C:\Program Files\OpenJFX\lib" --add-modules=javafx.controls

I am running JavaFX-15 with JDK-15 on Netbeans 12.0.
Go to https://openjfx.io/openjfx-docs/#install-javafx (follow the guide for "JavaFX and NetBeans -> Non-modular from IDE").
In Netbeans, turn off the "compile on save" option:
Project Properties -> Build -> Compiling ->> Compile on save (off)
This got rid of the "Error occurred during initialization of boot layer... java.lang.module.FindException: Module javafx.controls not found".
Java FX-15 works beautifully. I hope this helps someone...
===
To me, it seems like the nb-javac is causing the problem....
===

I've just installed JDK15 and was encountering this issue as well. (macOS 10.14.6)
I used the .bash_profile environment and had defined the $PATH_TO_FX via.
vim .bash_profile
export PATH_TO_FX="/<file path including lib>" save and close (in quotation marks)
source .bash_profile load
Closed completely all terminal windows, rebooted terminal and ran echo,
echo $PATH_TO_FX, verified; and
resumed to compile and run the HelloFX file.
It may work for some, small oversight on my end
Very strange:
gilberto.andrade@C430760:~/tmp/JAVAFX/stage$ javac -version
javac 11.0.9
gilberto.andrade@C430760:~/tmp/JAVAFX/stage$ java -version
openjdk version "11.0.9" 2020-10-20
OpenJDK Runtime Environment (build 11.0.9+11-suse-lp152.2.6.2-x8664)
OpenJDK 64-Bit Server VM (build 11.0.9+11-suse-lp152.2.6.2-x8664, mixed mode)
gilberto.andrade@C430760:~/tmp/JAVAFX/stage$
It is compiling ..
gilberto.andrade@C430760:~/tmp/JAVAFX/stage$ javac --module-path ~/bin/javafx-jmods-11.0.2 --add-modules javafx.controls StageExamples.java
gilberto.andrade@C430760:~/tmp/JAVAFX/stage$
But not running ...
gilberto.andrade@C430760:~/tmp/JAVAFX/stage$ java --module-path ~/bin/javafx-jmods-11.0.2 --add-modules javafx.controls StageExamples
Error occurred during initialization of boot layer
java.lang.module.FindException: Module javafx.controls not found
gilberto.andrade@C430760:~/tmp/JAVAFX/stage$
You should only use the jmod files with jlink. Not with javac (although it happens to work, it isn't supported) or java.
You need to use the sdk if you want to locally compile and run.
No way with sdk ..
gilberto.andrade@C430760:~/tmp/JAVAFX/stage$ javac --module-path ~/bin/javafx-sdk-11.0.2 --add-modules javafx.controls StageExamples.java
error: module not found: javafx.controls
1 error
That should be javafx-sdk-11.0.2/lib
That should be
javafx-sdk-11.0.2/lib
Sorry, it was an oversight on my part. Thank you, @kevinrushforth ! Finally it is running!
