Дело в том, что я получаю эту ошибку, хотя изображение существует в указанном месте. Игра работает нормально и внезапно завершает работу с уже упомянутой ошибкой.
Ошибка:
Код: Выделить всё
Wed Nov 27 14:43:46 PST 2013 ERROR:Resource not found:
/home/tomtam/workspace/Game/gfx/world/object/blockgreen.png
java.lang.RuntimeException: Resource not found:
/home/tomtam/workspace/Game/gfx/world/object/blockgreen.png
at org.newdawn.slick.util.ResourceLoader.getResourceAsStream(ResourceLoader.java:69)
at org.newdawn.slick.opengl.InternalTextureLoader.getTexture(InternalTextureLoader.java:273)
at org.newdawn.slick.Image.(Image.java:270)
at org.newdawn.slick.Image.(Image.java:244)
at org.newdawn.slick.Image.(Image.java:232)
at org.newdawn.slick.Image.(Image.java:198)
at tomtam.game.object.BlockGreen.render(BlockGreen.java:18)
at tomtam.game.main.World.render(World.java:447)
at tomtam.game.state.PlayState.render(PlayState.java:76)
at org.newdawn.slick.state.StateBasedGame.render(StateBasedGame.java:207)
at org.newdawn.slick.GameContainer.updateAndRender(GameContainer.java:703)
at org.newdawn.slick.AppGameContainer.gameLoop(AppGameContainer.java:456)
at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:361)
at tomtam.game.main.Main.main(Main.java:36)
Wed Nov 27 14:43:46 PST 2013 ERROR:Game.render() failure - check the game code.
org.newdawn.slick.SlickException: Game.render() failure - check the game code.
at org.newdawn.slick.GameContainer.updateAndRender(GameContainer.java:706)
at org.newdawn.slick.AppGameContainer.gameLoop(AppGameContainer.java:456)
at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:361)
at tomtam.game.main.Main.main(Main.java:36)
Код: Выделить всё
public void render(GameContainer gc, Graphics g) throws SlickException
{
super.render(gc, g);
image = new Image("/home/tomtam/workspace/Game/gfx/world/object/blockgreen.png");
}
Код: Выделить всё
try
{
image = new Image("/home/tomtam/workspace/Game/gfx/world/object/blockgreen.png");
}
catch (RuntimeException npe)
{
}
Код довольно длинный, но я могу его опубликовать , просто спроси. Любая помощь будет оценена по достоинству.
Подробнее здесь: https://stackoverflow.com/questions/202 ... -not-found
Мобильная версия