I just started learning Java and i use eclipse.
At the moment i work on a Pong game and i want to include some pictures
i.e. a ball instead of a circle, to make it look better.
This is the Code i use to load the image:
try {
img_ball = ImageIO.read(new File("/home/michael/Desktop/workspace-java/JPong/src/ball2.png"));
} catch (IOException e) {
System.out.println("ball2.png not found!");
}
As you can see i use absolute paths, because relative would not work at all.
But using absolute paths is not what i want since i'm not the only to playing it.
Where do i have to place those files to be accessible relatively?
I would also like to put it INTO the jar file, so the release is just one file to run without the folders with files
Thanks in advance!