There are similar questions like this or this other one.
Before JavaFX 11, whenever you were calling something JavaFX related, you had all the javafx modules available within the SDK.
But now you have to include the modules/dependencies you need.
Your error says that you are using FXML but it can't be resolved, but you have just added the javafx.controls
module:
--add-modules=javafx.controls
As you can see in the JavaDoc the javafx.controls
module depends on javafx.graphics
and java.base
, but none of those modules includes the FXML classes.
If you need FXML classes like the FXMLLoader
, you need to include javafx.fxml
module:
--module-path="C:Program FilesJavajavafx-sdk-11lib"
--add-modules=javafx.controls,javafx.fxml
The same will apply if you need media or webkit, those have their own modules.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…