I am attempting to read a file as follows:
File imgLoc = new File("Player.gif");
BufferedImage image = null;
try{
image = ImageIO.read(imgLoc);
}
catch(Exception ex)
{
System.out.println("Image read error");
System.exit(1);
}
return image;
I have a file named "Player.gif" as shown in imgLoc, but I do not know where to put the file. Where will eclipse look to find the file when I attempt to read it?
Edit: Also, is there a better way of creating a BufferedImage from an image file stored somewhere amongst the project directories? (IE. A better way of reading an image than through File, or a better method within File to create a BufferedImage)