Caused by: java.lang.NullPointerException: Location is required

将
Parent root = FXMLLoader.load(getClass().getResource("xml/MainUI.fxml"));
改为:
 Parent root = FXMLLoader.load(getClass().getClassLoader().getResource("xml/MainUI.fxml"));
原文地址:https://www.cnblogs.com/xiaojf/p/11060023.html