Image img; String path = getClass().getResource("image.png").getPath(); img = Toolkit.getDefaultToolkit().createImage(path);
When i run the jar, it errors out when:
String path = getClass().getResource("image.png").getPath();
is called... like the path is incorrect or something, and the image cannot be found. Do i have to use some other way or URL to access the image? I know its possible because i can access text files within a jar, so Images should really be no different. Any help is greatly appreciated and thanks in advance!