Locating default root folder for an Eclipse project

eclipse, file, java

Solution

In the run dialog you can choose the directory. The default is the project root.

Problem

I am reading 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 do not know where to place my file to make the Eclipse IDE, and my project can detect it when I run my code. Is there a better way of creating a BufferedImage from an image file stored in your project directory?

Original source