|Problems with exporting to jar with images in eclipse - getting instability [message #1785875]
||Sat, 21 April 2018 17:35
| Corey Saines
Registered: April 2018
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(getClassLoader().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.
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
Powered by FUDForum
. Page generated in 0.02721 seconds