I made a cheesy pong game with images that pop up and other distractions. I accessed my images as so:
zappa = new ImageIcon("/images/zappa2.jpg");
(yes, a pony-tailed pic of frank zappa pops up to block part of the screen and then starts moving around as further distraction)
I tried to export as a jar and a runnable jar, but either way, the program worked fine but no pictures showed up in my game.
I read a bunch of stackoverflow forums and found something that semi-worked. I changed the path to:
zappa = new ImageIcon(getClass().getResource("/images/zappa2.jpg"));
When I exported to a jar, the pictures showed in the game! However, whenever I comment out my old path and use the new getResource path, the game becomes very unstable. It only loads a rare number of times out of a set of attempts. In both eclipse and the exported jar, most of the times I try to load the program, I just get an empty frame, and on some occasions, I get game play, but my paddle is unresponsive to the mouse.
I want the stability of my first path, but the pictures exporting correctly of my second path.
Suggestions?
Also, what do I want: jar or runnable jar? This is my first GUI program. Previously, I've made text programs, exported to jar, and ran them thru terminal.
Thank you, core