I'm trying to load an ImageIcon as described here, but I'm getting an error. Tried the method here too, but ran into the same error. It says:
"Uncaught error fetching image:
java.lang.NullPointerException..."
I couldn't find a solution to this. I can load the image icon using this:
setIconImage(new ImageIcon("etc/image.png").getImage());
But then it doesn't work with a .jar.
EDIT: using
Image im = ImageIO.read(new File("etc/image.png"));
And then creating the ImageIcon gives me no errors, but doesn't work with the .jar, even if I use the Export option as described here.
EDIT 2: Okay, putting my /etc folder inside the /bin folder created for the project solved this. I have ABSOLUTELY NO IDEA why, so I'd be thankful if someone could explain that one to me. Wait, nevermind that. It doesn't work for the .jar.
EDIT 3: Solution to the problem here.
Basically, you create a folder within /src and then import the files into it. Man, I can't believe I lost so much time over this. RAGE