Use JFrame.SetIconImage(new ImageIcon(".\\image.jpg")).getImage());
Keep the image file in the package in workspace, if you are running from the eclipse.
If you export the file from Eclipse as Excecutable Jar file then keep the image file in the same folder where you saved the jar file.
To use ImageIcon include this statment import javax.swing.ImageIcon;
This is one way......
i don t want to use jframe...
consider a case when there is error in java program in eclipse, the java file icon gets changed to red cross(x) mark. in the same way, whenever my program executes the icon should be changed. Is there any way to do that?