openjfx-docs icon indicating copy to clipboard operation
openjfx-docs copied to clipboard

Module not found error

Open tahunt042 opened this issue 6 years ago • 14 comments

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.

tahunt042 avatar Oct 23 '19 21:10 tahunt042

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

Mason-Chou avatar Oct 31 '19 21:10 Mason-Chou

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 avatar Nov 05 '19 03:11 avacadoadam

@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

Mason-Chou avatar Nov 05 '19 04:11 Mason-Chou

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?

harryhuk avatar Nov 07 '19 12:11 harryhuk

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

shreya888 avatar Aug 06 '20 10:08 shreya888

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.

ghost avatar Sep 06 '20 16:09 ghost

Same problem as above. No clue what to do. --module-path="C:\Program Files\OpenJFX\lib" --add-modules=javafx.controls

idea64_bOYaIHQNwo

jordan-git avatar Sep 14 '20 03:09 jordan-git

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....

=== nb-javac

my-gh-account avatar Sep 15 '20 15:09 my-gh-account

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

doyoko avatar Oct 11 '20 15:10 doyoko

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$ 

gilbertoca avatar Jan 08 '21 20:01 gilbertoca

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.

kevinrushforth avatar Jan 08 '21 20:01 kevinrushforth

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

gilbertoca avatar Jan 08 '21 21:01 gilbertoca

That should be javafx-sdk-11.0.2/lib

kevinrushforth avatar Jan 08 '21 21:01 kevinrushforth

That should be javafx-sdk-11.0.2/lib

Sorry, it was an oversight on my part. Thank you, @kevinrushforth ! Finally it is running!

image

gilbertoca avatar Jan 09 '21 19:01 gilbertoca