Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Problems with exporting to jar with images in eclipse - getting instability

stinkfoot70Apr 30 2018 — edited May 2 2018

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

Comments

if you're dealing with files, it does just that already

sorosch

Hmmm - what does you mean with that:

thatJeffSmith-Oracle schrieb:

if you're dealing with files, it does just that already

Do you mean the query to save each tab when closing SQL Developer? So i have tiles of each tab - and that is very ugly.

i mean, any FILES you have open when you shut down sql developer, when you re-open the app, those files will be re-opened

sorosch

OK - that´s correct - when saving an open tab as a file then the FILE ist re-opened. But without saving the tab as a file this is not possible - or?

2693955

Yes, it does do this but does anyone know where the file/temp location of what has been open is located. The reason for the ask when I move to new computers or upgrading to a new version of SQL you lose those file tabs and a user has to take a screen pic to open them all over again and close the app to get whole again.

thanks Chris

SQL tabs.jpg

1 - 5
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on May 30 2018
Added on Apr 30 2018
9 comments
4,568 views