The typical way to set this up is to create your folders like this in Eclipse:
bin/
resources/
src/
Create your package structure in resources
exactly like it is in src
and bin
. Copy your image file to the same package in resources
as the class that will try to load it in src
.
In Project > Properties > Java Build Path > Source, add both src
and resources
as source folders. Now when you build the project the contents of resources
will be copied over to bin
and it will work from your IDE as well as from a JAR.