I am trying to write a java program, where i can set the icon of a form with my own gif file.
The problem is , when i run the program from IDE it runs ok, but when i try to run it from the dist folder clicking the jar file, my icon disappears and default java cup icon is show.
How can i solve this problem ?
I am doing something like this:
IDE ide=new IDE();
ide.setIconImage(Toolkit.getDefaultToolkit().getImage("edited.gif"));
ide.setVisible(true);
And my gif file is in the project folder. Say my project name is X. So i put the gif file in X folder.
So the thing is that you have to also copy the image to the dist folder next to your jar. And it will work fine.
To save me time remember to do it in NetBeans I edit the build.xml file and the IDE does that for me automatically. Just put the below code just over the
</project>tag. And I would recommend to have always all images in a certain folder in my can it is images folder.