Problem in setting icon for JFrame!
I want to change the icon of the JFrame. I have done this by coding. It is working fine in NetBeans IDE. But it is not displaying the icon after building jar.
I am getting this problem when i am trying to run the jar file.
I have tried the following codes. But they are not working after building jar.
(I kept the image file in resources folder).
Please go through it and suggest me possible workarounds.
this.setIconImage(java.awt.Toolkit.getDefaultToolk it().getImage(Step1.class.getResource("myicon.jpg" )));
InputStream imgStream = this.getClass().getResourceAsStream("myicon.jpg");
BufferedImage bi = ImageIO.read(imgStream);
ImageIcon myImg = new ImageIcon(bi);
Thanks in advance!