nus-cs2103-AY2122S1 / forum

18 stars 2 forks source link

💡 Tip for "Caused by: java.lang.ClassNotFoundException: MainWindow javafx" when running Launcher #165

Open kevinchua6 opened 3 years ago

kevinchua6 commented 3 years ago

They didn't give any info about the error, so I was confused for a while, but here is the fix:

Change in MainWindow.fxml: <AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="600.0" prefWidth="400.0" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1" fx:controller="MainWindow"> To <AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="600.0" prefWidth="400.0" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1" fx:controller="duke.gui.MainWindow"> (Add the package name)

Hope this helps anybody facing the same issue!

Yukun99 commented 3 years ago

It will depend on where everyone puts their files and how they structure their packages, but generally change the value for fx:controller to your own package path to MainWindow and it should work fine.