I was recently copying some code from one project to another (yes, we all do it) and I hit a problem – it wouldn’t run. The error message was less than useful as shown below.
Caused by: java.lang.IllegalStateException: Location is not set. at javafx.fxml.FXMLLoader.load(Unknown Source) at javafx.fxml.FXMLLoader.load(Unknown Source)
Obviously there was more stack trace than this but it was a lot of unknown source and then it dived into my code but not to show me anything useful. What my code was trying to do was load an FXML file and display the resulting interface sections.
After a quick bit of digging it turns out this unhelpful error message normally means that the application was unable to locate the FXML file it is being asked to load. Turns out I’d forgotten to copy over the file and I’d not updated the path it was using (the package changed).