i dont know why this simple program is not working
import javax.swing.*;
public class Main {
public static void main(String[] args) {
JFrame frame = new JFrame();
frame.setSize(600,600);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
ImageIcon img = new ImageIcon(frame.getClass().getResource("/images/4.png"));
JLabel lbl1 = new JLabel(img);
frame.add(lbl1);
frame.setVisible(true);
}
when i run the program this error appears :
Exception in thread "main" java.lang.NullPointerException
at java.desktop/javax.swing.ImageIcon.<init>(ImageIcon.java:217)
at graphic_example9.Main.main(Main.java:12)
as you see in this picture i added images directory to my project directory :
(my os is debian 10.3 and my IDE is netbeans 11.3)