Loading resources location.
Have you tried it?
You need your resources next to your jar, or in the case of running it from Eclipse, inside your project folder.
Say that you have a Slick2DGameProject folder, inside your resource folder, inside texture folder, and inside that a tile1.png.
You'd load it up from Java with just the relative path.
ImageBuffer img;
File fileDir = new File("resource/texture/tile1.png");
img = ImageIO.read(fileDir);
My loader is a static class and has a few static Strings like "String resourceDir = resource/" "String texturedir = texture/" and so on. So when I load up a file I "compose" the file location with "resourceDir + textureDir + fileName". That way you only call your loading method with the file name (fileName) and it resolves the rest of the path by itself.
I don't know if its the best way but it worked well so far (tested in Linux and Windows).
Too bad, I can't figure this out. This is what I have:

You can also see the error I get on the bottom.
Got it fixed with some help from the guys at #reddit-gamdev on freenode irc. I had to type "./resources/bat.png".
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.