Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Problems with exporting to jar with images in eclipse - getting instability
Problems with exporting to jar with images in eclipse - getting instability [message #1785875] Sat, 21 April 2018 17:35 Go to next message
Corey Saines is currently offline Corey SainesFriend
Messages: 2
Registered: April 2018
Junior Member
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.

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
Re: Problems with exporting to jar with images in eclipse - getting instability [message #1786273 is a reply to message #1785875] Sun, 29 April 2018 07:35 Go to previous message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 3155
Registered: July 2009
Senior Member

We're not a general Java programming forum. This looks like the sort of question to take somewhere like
StackOverflow or the relevant JavaRanch forum, https://coderanch.com/f/2/GUI .


Nitin Dahyabhai
Eclipse Web Tools Platform
Previous Topic:How to create a new eclipse console from java code?
Next Topic:Remove red box around brackets
Goto Forum:
  


Current Time: Sun May 20 23:44:14 GMT 2018

Powered by FUDForum. Page generated in 0.03018 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top