I'm trying to make a jar, but the program needs images. When I ran the jar, the images didn't show up. However, they did in eclipse. I used this code:
label.setIcon(new ImageIcon("res/img/icon.png"));
Then I went looking on the internet for a way to fix it. I found this question here on StackOverflow, but when i tried it in my code, it's throwing a NullPointerException
(also in eclipse). This is my code now:
label.setIcon(new ImageIcon(getClass().getResource("/res/img/icon.png")));
The images are in a separate folder in the package, called "res":