0

I would like to change the default Java icon (the design of the cup). I used the code below in the constructors of JFrames of my system and it worked only when I run the system in Netbeans, but when I generate the executable can not start my program!

setIconImage(Toolkit.getDefaultToolkit().createImage(getClass().getResource("/ICONES/add.png")));
Gustavo
  • 17
  • 6
  • Because the image should be included to the JAR. – Maroun Dec 17 '14 at 20:41
  • open your JAR file using program like 7zip then put your ICONES folder inside it. – Fevly Pallar Dec 17 '14 at 20:44
  • @fev Or Just use a build system which includes the resources or a suitable IDE... – MadProgrammer Dec 17 '14 at 20:46
  • @MadProgrammer, I have no doubt on you ! – Fevly Pallar Dec 17 '14 at 20:46
  • Also see [this example](http://stackoverflow.com/questions/27306872/seticonimage-only-works-in-eclipse-doesnt-work-when-exported-as-runnable-jar-fi/27307113#27307113), [this example](http://stackoverflow.com/questions/18224184/sizes-of-frame-icons-used-in-swing) and [this example](http://stackoverflow.com/questions/19825481/setting-an-icon-for-my-java-application/19825494#19825494) for a more flexible alernative – MadProgrammer Dec 17 '14 at 20:47
  • Hello. If I open my executable with Winrar for example, I can see that the ICONS folder, where my image is already in the executable. And now, what to do? – Gustavo Dec 17 '14 at 22:01

0 Answers0