wood burning stoves*
The moose likes Swing / AWT / SWT and the fly likes All images are showing in Eclipse, only half when exported as Runnable Jar Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "All images are showing in Eclipse, only half when exported as Runnable Jar" Watch "All images are showing in Eclipse, only half when exported as Runnable Jar" New topic
Author

All images are showing in Eclipse, only half when exported as Runnable Jar

Ivan Slavka
Greenhorn

Joined: Feb 06, 2012
Posts: 11
Hi guys!

I have a very strange problem. And I can't figure out what could be the problem.
I am developing my clone of the old game Frogger, I think that everybody knows the game I'm talking about.
Well the main reason to develop Frogger is to learn about java games and 2D graphics, anyway this is my problem.

When I run my Frogger application in Eclipse, all the images are shown with no problem with the appropriate animation
(Logs moving in one direction car in another), then when I export this project as Runnable Jar and start it, I can see all images,
except the car images. I know that the missing car images are moving because when I move my frog on the road it gets killed (returns to the start position.)

This is my class that loads and holds the required images. All the images are in the same folder (source)


This is my complete frogger application, feel free to download and study the code. (I didn't test on another machine, so if it works well on your machne let me know.)
Frogger
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19651
    
  18

I had to decompile your class files to find the problem, but it was quite obvious after that. Your files are called Car_A.png and Car_B.png, but the resource names are CAR_A.png and CAR_B.png. Unlike regular files on Windows, resources are case sensitive.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Ivan Slavka
Greenhorn

Joined: Feb 06, 2012
Posts: 11
Wow, Rob, thanks.

I wouldn't guess that, not in a million years. Well they could put that into the JavaDoc.
Thanks once again!
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19651
    
  18

You're welcome
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: All images are showing in Eclipse, only half when exported as Runnable Jar
 
Similar Threads
loading large images safely
Networking question from Jonathan Knudsen - Beginning J2ME..
Networking question from Jonathan Knudsen - Beginning J2ME..
Another Image Doesn't Display Thread
Help with paint to panel