0
votes

Following instructions at https://openjfx.io/openjfx-docs/#install-javafx https://openjfx.io/openjfx-docs/#install-javafx, I compiled the sample HelloFX.java via:

javac --module-path $PATH_TO_FX --add-modules=javafx.controls HelloFX.java 

I got error:

error: module not found: javafx.controls
1 error

then I add the line as instructs: javac --module-path $PATH_TO_FX --add modules=javafx.controls.javafx.fxml HelloFX.java

and got error:

error: module not found: javafx.fxml
error: module not found: javafx.controls
2 errors

then I add the last line in the instructions: java --module-path $PATH_TO_FX --add-modules=javafx.controls HelloFX

and got error:

Error occurred during initialization of boot layer
java.lang.module.FindException: Module javafx.controls not found

Please help!

1
Please edit it and make it more readable. - idan
$PATH_TO_FX is a variable meant to either be set by you or replaced with the actual path to the JavaFX SDK. Did you do that? - Slaw
Yes I did. It still created the same errors that I mentioned above - Chau Le
I believe the SDK is downloaded as a ZIP file, at least for Windows. Did you extract the contents and then point to the lib directory? - Slaw

1 Answers

0
votes

I had to also include the 'lib' directory: --module-path %PATH_TO_FX%;%PATH_TO_FX%\lib to make it compile. (Windows 10)