I use Netbeans IDE, some where in the code I included this
ImageIcon accept_icon = new ImageIcon("src/images/accept.png");
When I run the project inside the IDE it display fine. However, when I try to build the project, it seems like external sources that I specified (images, template files, etc…) does not get included. Is it because how I specified the source (e.g src/images/accept.png ) ? If it is, how should I solve this problem? Sorry to ask such a simple question, Im quite new to java.
If you’re talking about building a jar and then running it then you have to embed the resources inside the jar explicitly if you want them there, and use the
getResourceAsStream()method to use them.See here for more information.