I'm working on a java project and made it into an executable jar. In the jar, all the correct files are included, but when running the jar, the images don't display.
When I run the program from command line, the program is able to display everything correctly.
I believe the issue might be because of how I set up the filepaths in the code? Here's an example of my setup:
private static String imgPath;
...
imgPath = String.format("img%d.gif", value);
...
public static ImageIcon getImageIcon() {
ImageIcon ii = new ImageIcon("content/dice/" + imgPath);
return ii;
}
//getImageIcon() is later called by another class
This setup works unless I try to run the program from an executable jar. So my question is how do I get it to work from a jar?