java - Attempting to set JLabel icon to image directory, null pointer exception instead -
exception in thread "awt-eventqueue-0" java.lang.nullpointerexception @ javax.swing.imageicon.(imageicon.java:205)
jlabel background = new jlabel(new imageicon(getclass().getresource("/resources/splashscreen.jpeg")));
the above line exact line throwing exception, , makes me believe location of file not correct, have tried numerous things no success.
the folder structure seems correct, image within resources folder within project folder, , folder(with image) next src folder not within. application has have ability of being used offline otherwise use url. there known bug in eclipse ide?
figured out. seems putting file in wrong location, putting .class files solved problem. not sure if proper solution or work around unfortunately. had go basics .java files compiled , .class files running, , need backtrack current working directory.
actually, have put "resource" folder source folder in case.
Comments
Post a Comment