Where do I store files such as images in a Java project? -


i'm trying access .jpg file use background this:

jlabel label = new jlabel(new imageicon("star_wars.jpg"));; 

if change path picture directory on computer has file, works, want give program out, means show on pc. i've tried storing in multiple areas in project itself, , haven't had luck. in source folder called resources. should do?

store relative class file. in example, put image file @ same location class file.

imageicon icon = new imageicon(myclass.class.getresource("star_wars.jpg")); 

Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

Error while updating a record in APEX screen -

single sign on - Logging into Plone site with credentials passed through HTTP -