My java project looks like this:
FirstGame
src
(default package)
0.png
(The code is stored in default package.)
I load my images:
public static void loadImages() {
for (byte i = 0; i < 1; i++) {
try {
image[i] = ImageIO.read(new File("src/" + i + ".png"));
} catch (IOException e) {
e.printStackTrace();
}
}
}
(No errors are given when compiling and I can display the image in the game.)
When I export the project into a runnable jar file it seems as if the image doesn’t exist. I can extract the jar’s contents with 7-zip and I can clearly see my image is there however.
So the question is, how do I make sure the image is included and in the right place when I export it?