Hello all
Based on feedback from http://stackoverflow.com/questions/861500/url-to-load-resources-from-the-classpath-in-java i have changed my project, to include my image resources into Images.jar
My project setup is now
/program.jar
/Images.jar
In my code i load my images using
InputStream connectedImage = ClassLoader.getSystemResourceAsStream("images/logo.png");
My Eclipse setup is
/src/...
/images/logo.png
My problem
Eclipse cannot find the Systemresource based on that url. In order to get it to work, i have to
- Manually create Images.jar containing my image folder
- Add the Images.jar file to the Eclipse project
What I need
How can i configure Eclipse so i can use the same code to load the image from either Images.Jar (if run from commandprompt) or from the images folder(if run from Eclipse)?
Is there any way to make Eclipse include my /images/ folder when creating a runnable jar file of my program? Currently it does not include anything besides refereced jar files and source code.