Код: Выделить всё
Exception in Application start method
java.lang.reflect.InvocationTargetException
at java.base jdk.internal.reflect.DirectMethodHandleAccessor.invoke...
Caused by: java.lang.IllegalArgumentException: File not found: images/BG/BG.jpg
at gui.ImageManager.getBackgroundImagePath(ImageManager.java:41)
at gui.Scene_Menu.(Scene_Menu.java:56)
at gui.Main.start(Main.java:10)
project (battleshipgame) /resources/images/bg/bg.jpg < /em> < /p>
< /blockquote>
Несмотря на эти шаги, приложение все еще выбрасывает ошибку файла, не найденный. < /p>
Ниже приведен Разбивка кода ошибки. < /p>
Код: Выделить всё
public InputStream getBackgroundImagePath() {
String imagePath = "images/BG/BG.jpg";
InputStream inputStream = getClass().getClassLoader().getResourceAsStream(imagePath);
if (inputStream == null) {
throw new IllegalArgumentException("File not found: " + imagePath);
}
return inputStream;
}
Может ли кто -нибудь помочь мне отметить папку ресурсов для проекта GIT в Eclipse. Мои другие участники проекта используют другие IDE. Я единственный, у кого возникает эта проблема, когда я тянул проект, поэтому FilePath не может быть неверным.
Подробнее здесь: https://stackoverflow.com/questions/793 ... urce-image
Мобильная версия