I am trying to export to a runnable JAR of my project that has the following structure:
Project
|
|---Source folder
| |
| |
| .java files
|
|
|---Image folder
|
|
.png files
The .png
images are read inside the .java
files using ImageIO.read(new File("ImageFolder/image.png"));
which works fine when I run the program in Eclipse, but if I export to a runnable JAR, I get the following exception in the stacktrace:
javax.imageio.IIOException: Can't read input file!
at javax.imageio.ImageIO.read(Unknown Source)
Here is a screenshot of my project in Eclipse:
How can I include the cardImages
folder in my JAR so that new File("cardImages/10C.png")
can be read?