java - Intellij can't find .png -
my intellij can't find local .png images.
private string craft = "craft.png"; imageicon ii = new imageicon(this.getclass().getresource(craft));
the .png located in same directory java files. don't understand why isn't working. using maven build, tried alternating resources java, still no luck :(
craft.png
must placed src/main/resources
, otherwise not copied classpath according maven rules. see this answer more details.
your code should changed to:
private string craft = "/craft.png";
here sample working project.
Comments
Post a Comment