ImageIcon icon= new ImageIcon(getClass().getResource("image path"))
doesn't work after creating jar file in netbeans. So my jar file can not run but when I run in netbeans it works perfectly please help me.
ImageIcon icon= new ImageIcon(getClass().getResource("image path"))
doesn't work after creating jar file in netbeans. So my jar file can not run but when I run in netbeans it works perfectly please help me.
You must tell NetBeans that it should pack your image directory into the jar.
Use get getResourceAsStream instead
ImageIcon icon= new ImageIcon(getClass().getClassLoader().getResourceAsStream(String))
This link