Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+7 votes

I am getting the error Caused by: java.lang.IllegalStateException: Location is not set when trying to load a new FXML file after clicking a button to navigate to another page. How can I resolve this?"

asked in CSC 305 Fall 2024 by (1k points)

1 Answer

+1 vote

My guess is that this has something to do with when you are setting the root or calling the loader - you'll have to input the FXML class name exactly as a string with .fxml. For example:
FXMLLoader loader = new FXMLLoader(getClass().getResource("WelcomeScreen.fxml"));

answered by (2.8k points)
...