Exception in Application start method java.lang.reflect.InvocationTargetException

For anyone who has this exact same problem in the future, as James_D and the other answer contributors mentioned, removing the "/" at the beginning of the path fixes the problem so use

FXMLLoader loader = new FXMLLoader(Main.class.getResource("MainWindowView.fxml"));

instead of

FXMLLoader loader = new FXMLLoader(Main.class.getResource("/MainWindowView.fxml"));

This problem can also occure even when the path is completely right.

  1. When you create the fxml file in an Updated IDE.

  2. Then use an older JavaFX Scene Builder to design it.

Solution :

  1. Create the fxml file in JavaFX Scane Builder

  2. Design the fxml file in JavaFX Scane Builder then copy this to the IDE or Project.


guess its this ?

@FXML
void handleButton(ActionEvent event) {