I made an application in Java (using the Eclipse IDE) and i refer in the code to images stored in a source folder called “source” and it worked fine in the IDE. When I extracted the jar to an runnable jar, there are no errors but the picture doesn’t show up, or if it does it just shows whatever’s behind it. I opened up the .jar in WinRar and it appears the pictures are all thrown in with the class files. How can I fix this?
Image i = Toolkit.getDefaultToolkit().getImage("sources/SystemTrayOne.png");
You’re trying to get a file which doesn’t exist in a Jar. Instead get the URL via the
Class#getResource(...)e.g.,
or better