I am trying to change the icon of my Java application. Here is the structure of my project:
src
   gui
      FileCopyManager.java
images
    folder.png
Now I have the following code:
public class FileCopyManager extends JFrame{
    public void changeIcon() {
        this.setIconImage(new ImageIcon(Toolkit.getDefaultToolkit()
                .getClass().getResource("../../images/folder.png")).getImage());
    }
    public FileCopyManager() {
        changeIcon();
        this.setSize(800,600);
        this.setVisible(true);
    }
    public static void main() {
        new SwingUtilities.invokeLater(()->{
            new FileCopyManager();
        });
    }
}
However when I try to run this code I get a NullPointerException on the
this.setIcon line.
Any ideas?
 
     
    