java - Eclipse: code can't get imported image from package. Code works when read from C:/ -
when try make imageicon = new imageicon("source"); code doesn't read eclipse package want when tell read c:/... file works. why , how can fix it?
new imageicon("source")
expecting file
reference. resources maintained within application not (normally) considered files, instead, considered be, well, resources.
this means can't access them using "noraml" approaches might used to.
instead, try using getclass().getresource("/path/to/resource/source")
where path path top of source tree...
Comments
Post a Comment