Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JavaFX Modular Application, java.lang.module.FindException: Module javafx.controls not found (Java 11, Intellij)

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:

enter image description here

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:

enter image description here

but still, i got this error messages.

like image 298
rizky ramadhan Avatar asked Dec 15 '18 17:12

rizky ramadhan


People also ask

Why JavaFX is not working in IntelliJ?

Make sure the JavaFX plugin is enabled To be able to work with JavaFX in IntelliJ IDEA, the JavaFX bundled plugin must be enabled: In the Settings/Preferences dialog ( Ctrl+Alt+S ), select Plugins. Switch to the Installed tab and make sure that the JavaFX plugin is enabled.

How do I fix JavaFX control not found?

To Solve error: module not found: javafx. controls Error You just need to add PATH_TO_FX. First of all Use %PATH_TO_FX% instead of $PATH_TO_FX in the command line. Then Recreate the variables for both system and user PATH_TO_FX enclosing its value in quotation marks.


1 Answers

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.

like image 129
Naman Avatar answered Oct 11 '22 20:10

Naman