JavaFX: ошибка местоположения не установлена, хотя она компилируется и отлично работает в среде IDE - PullRequest
0 голосов
/ 10 июля 2020

При запуске моего кода в eclipse он работает безупречно; однако, когда я экспортирую его, я получаю сообщение «Местоположение не установлено» и не понимаю, почему. Эта определенная c часть кода работает каждый раз при экспорте prio мне, конвертируя проект в проект maven.

Вот фрагмент кода, который вызывает ошибку:

private static void showMainView() throws IOException {
    FXMLLoader loader = new FXMLLoader();
    loader.setLocation(Main.class.getResource("MainGUI.fxml"));
    System.out.println(loader.getLocation());
    Main.mainLayout = loader.load();
    Scene scene = new Scene(mainLayout);
    Main.primaryStage.setScene(scene);
    Main.primaryStage.show();
}

Вот моя файловая структура:

enter image description here

Here is the program working in the eclipse IDE with a print out of the file location

enter image description here

Here is the program error when troubleshooting in a powershell window with a print out of the file location being "null"

enter image description here

Could converting the project to a maven project have caused this? The reason I had to do this was the reflections library I'm using I could only find via a Maven dependency здесь https://github.com/ronmamo/reflections/tree/master

Если для устранения неполадок требуется больше , Я постараюсь сделать все, что в моих силах, потому что он поставил меня в тупик

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...