I'm trying out the Eclipse Java 'Export Runnable JAR file". It creates a single JAR with all files in it, which is great. But one issue, in my project I have two directories and a few external libraries, like the following layout
- src
- resources
- mypic.jpg
- JRE System Library
- Referenced Libraries
- a bunch of external libraries
As usual 'src' contains all my codes. and resources contains some image files I use in the code. in my code, when I refer to mypic.jpg, I do:
String filename = "resources/mypic.jpg";
However, when I Export the project as runnable JAR file, it totally ignores the 'resources' directory, it put mypic.jpg into the top level directory, which makes "resources/mypic.jpg" in my code won't work at all. 'resources' directory is not created neither in the JAR file
I tried creating the "resources" directory using both 'New->Folder', 'New->Source Folder', none avail.
here is my "Source folders on build path" on Build Path configuration
MyProject/resources MyProject/src
My Eclipse build (Windows XP): Eclipse Java EE IDE for Web Developers. Build id: 20090621-0832