I have a project and I want to export an runnable jar file. But I have one image and a text file. If I export a file, it is exported without an image and text file.
Code:
ImageIcon icon = new
ImageIcon(Main.class.getClassLoader().getResource("STM.png"));
win.setIconImage(icon.getImage());
error:
Exception in thread "main" java.lang.NullPointerException: Cannot invoke "java.net.URL.toExternalForm()" because "location" is null
at java.desktop/javax.swing.ImageIcon.<init>(ImageIcon.java:217)
at Main.Main.main(Main.java:110)