Hello!
I am currently working on a project with a few others. Everything has went on smoothly until now.
When I run the project in NetBeans, everything is working as intended. All images show up like they should.
If I start the jar file with the console commands (java -jar filename.jar), everything works fine too. BUT, when I doubleclick the jar file itself, some images are not showing up. The code for some of those images are identical to others. I've doublechecked this multiple times, and I have no idea what's wrong.

Does anyone know what could be wrong here?

You may have a problem with case-sensitivity in your file names. Windows file names are not case sensitive, but when you access the same resources from a jar I think they are case sensitive.

Thanks for the reply!
Every image file is using lower-case characters though, so that can't be the problem.

Hi,
I've faced something like this before, but on a different area I think you should check the image references in netBeans or try to load it again using netBeans itself.

I hope this benefits you, happy coding.

[EL-Prince]

Hm, I haven't used any IDE specific image loading features or resource management at all.
I don't know if this helps, but new File("path/to/image.png").exists() returns true, even when the image isn't showing.

@Acegikmo
Hi, are you really need your project as .jar distribution file or it doesn't matter, if you do, try to find any .exe java wrapper for this and try to run it, I think you'll avoid any problems loading images from jar files, because all you need is .class files to produce .exe binary.

I hope this works with you.

DON'T GIVE UP!!!

[EL-Prince]

This article has been dead for over six months. Start a new discussion instead.