Firstly, I am loading my images into an ArrayList like this:
randomGem.add(0,ImageIO.read(new File("res/RedGem.png"))); //randomGem is an ArrayList<BufferedImage>
Basically, the gem images are loaded into JPanels and then are placed on a board image that is in a JPanel. The final board/gems JPanel is loaded into my JFrame window.
My folder structure is like so:
On searching for an answer, many people said to make my "res" folder a source folder inside of eclipse. So I have done that(right click->Build Path->Make Source).
My application runs fine in Eclipse at this point.
After creating the .JAR file, its file structure is like so:
On dclicking the .JAR, it opens a blank window w/ no images and sort've hangs there. I have the impression that it's throwing the exception about not finding the file.
Even if I move the .JAR into a folder that contains the images, still does not work.
I removed the res/ in:
The application and the .JAR both pop up a blank window.
However if I move the .JAR into a folder containing all of the *.png, the .JAR runs perfectly.
I'm starting to get burnt out on trying to figure this out.
I've tried a few other things that I can't even remember, since it's been quite a few hours.
I have created many, many .JAR files, but never any using images in a separate folder. My manifest file is correct, and I am also compiling using the 1.6 compliance level.
What am I doing wrong?
How do people normally set up resource and source directories? Obviously it looks messy to have everything in just one root directory, so there must be a solution I haven't figured out?