I made a small java program with a Frame
showing a small ImageIcon
. I'm using IntelliJ to make my programs. When I click on "Run", it shows me the Frame
with the picture. Then I made a JAR file out of it, and now it just shows me the Frame
but not the Image
. What can I do?
Asked
Active
Viewed 85 times
-1
-
2Did you added the image to the project Resources folder? – yonisha Jun 11 '16 at 16:58
-
1You don't need to "sign" your posts with your username, we can see who posts the question. Anyways, please show some code in an [edit] to your question to include a [mcve]. – OneCricketeer Jun 11 '16 at 17:16
-
For examples, see [tag:embedded-resource] under _learn more…_ – trashgod Jun 11 '16 at 17:30
1 Answers
1
You must add the picture to your resources folder, and insert it in your classpath!

PcS
- 38
- 8
-
Do you mean with "You must add the picture to your resources folder" that i have to create a resource folder and add that picture into there? If so, I did that already. And how can I insert it into my classpath? – Kenta1561 Jun 11 '16 at 17:04
-
1
-
-
It depends on the IDE you´re using! check IDE doc. Then you´ll probably have to use: getClass().getResource("/someImage.png"); – PcS Jun 12 '16 at 14:54