JavaFX Modular Application, java.lang.module.FindException: Module javafx.controls not found (Java 11, Intellij)
23,933
Since you're running as a Non-Modular application from IntelliJ, you would need to ensure adding the VM argument as :
--module-path /path/to/javafx-sdk-11.0.1/lib --add-modules=javafx.controls,javafx.fxml
You can follow the documentation link as JavaFX and IntelliJ and then Non-modular from IDE for complete setup details.
Author by
rizky ramadhan
Updated on January 24, 2022Comments
-
rizky ramadhan over 2 years
I have a problem with my modular JavaFX application. I created a JavaFX project and added the JavaFX lib and JavaFX modules get recognized. However, I keep getting these error message:
Error occurred during initialization of boot layer java.lang.module.FindException: Module javafx.controls not found
Image for the complete setup is attached hereby:
edit:
this is all the errors messages:
/usr/lib/jvm/java-1.11.0-openjdk-amd64/bin/java -Djava.library.path= /home/thenekolite/Documents/JavaTools/javafx-sdk-11.0.1/lib --module- -path=~/Documents/JavaTools/javafx-sdk-11.0.1/lib --add-modules=javafx.controls,javafx.fxml --add-modules javafx.base,javafx.graphics --add-reads -javaagent:/home/thenekolite/idea-IU-183.4588.61/ lib/idea_rt.jar=35937:/home/thenekolite/idea-IU-183.4588.61/bin -Dfile.encoding=UTF-8 -classpath /home/thenekolite/IdeaProjects/ Latihan1/out/production/Latihan1:/home thenekolite/Documents/JavaTools/ javafx-sdk-11.0.1/lib/src.zip:/home/thenekolite/Documents/JavaTools/ javafx-sdk-11.0.1/lib/javafx-swt.jar:/homehome/thenekolite/Documents /JavaTools/javafx-sdk-11.0.1/lib/javafx.fxml.jar:/home/thenekolite/ Documents/JavaTools/javafx-sdk-11.0.1/libjavafx.media.jar: /home/thenekolite/Documents/JavaTools/javafx-sdk-11.0.1/lib/ /javafx.swing.jar:/home/thenekolite/Documents/JavaTools/javafx sdk-11.0.1/lib/javafx.controls.jar:/home/thenekolite/ Documents/JavaTools/javafx-sdk-11.0.1/lib/javafx.graphics.jar -p /home/thenekolite/Documents/JavaTools/javafx-sdk-11.0.1/lib/ /javafx.base.jar:/home/thenekolite/Documents/ JavaTools/javafx-sdk-11.0.1/lib/javafx.graphics.jar sample.Main Error occurred during initialization of boot layer java.lang.module.FindException: Module javafx.controls not found
I also add the vm options:
but still, i got this error messages.
-
rizky ramadhan over 5 yearsThank you for the answer, but I have following these step and still get error.
-
Naman over 5 years@rizkyramadhan In which case, could you expand the command line as visible in the terminal of IntelliJ and update with the same in the question? (The green highlighted line on your terminal ending with an ellipsis...)
-
rizky ramadhan over 5 yearsI've edited the post and put all the error messages. you know, I tried javafx on my windows 10 and it works perfectly, but I'm not always using windows, for a daily basis, I use Ubuntu 18.04 and it doesn't work. Hmm.
-
user2078674 about 5 yearsFor anyone else having issues, this worked for me: as Naman said.. --module-path "C:\Program Files\Java\javafx-sdk-11.0.2\lib" --add-modules=javafx.controls,javafx.fxml
-
Alexandr Kovalenko over 3 yearsI've got the same issue, and the problem was with the correct path to the javafx-sdk. In this case, you should update the path after unpacking javafx-sdk to the system very attentively!