I have 10 .png files that each have a number on them that im displaying in my program. each is entitled FB_1, FB_2 and so on respectively. when I try to load them into my Numbers.java file I'm having some trouble referencing them. I had them in a folder called res that was in the same directory as my src folder. I then loaded them as such.
for(int i = 0; i < 10; i++) {
try {
FB_[i] = ImageIO.read(new File("res/FB_" + i + ".png"));
}catch(IOException e) {
new JFrame("Error 403 - Can't read number Image Files!").
setVisible(true);
}
}
This worked fine but when i sent the program to my buddy he ran it on another IDE (I think jGrasp) and he said he got an error loading the images.
I ran this code in jGrasp and it didn't work so I proceeded to change the line to this
FB_[i] = ImageIO.read(new File("FB_" + i + ".png"));
and it worked.. I also ran it through command prompt and it worked again..
Now, when I went back into Eclipse and tried running the new code, i began getting the exception saying that it couldn't locate the files. I know as a fact they are saved in the default package with the java files but I don't know why it only can't access them in Eclipse.
Does anyone know why this happens?? I'm amateur and am sort of new to working with files so it may be something dumb.