How can my project access its “resources” directory both when run in Eclipse and from a Maven-packaged jar file?

To access your program's resources, don't use File FileInputStream and similar classes. They will not work for anything inside a jar file.

To access your program's resources, don't use File, FileInputStream and similar classes. They will not work for anything inside a jar file. Instead, use Foo.class.

GetResource(...) or . GetResourceAsStream() to access your resources. (Read the documentation before doing so.) I'm not sure if a program started from eclipse can access these - please try and report back!

Yes, a program started either from Eclipse or from a JAR file can access these as long as they are placed on CLASSPATH, i.e. In the src/main/resources directory. – Jiri Patera Aug 17 '11 at 19:51 Yes, it's working in Eclipse.

But one detail: m2e plugin exclude src/main/resources from classpath (this problem is described there). So you should erase one line from . Classpath file and everything will work.

Thanks! – Lampapos Aug 18 '11 at 7:39.

Your package configuration in Eclipse is wrong, cause it sees src/main/resources as a package instead of a source folder. The configuration in Eclipse must look like this.

When I include src/main/resources into classpath - it didn't help – Lampapos Aug 18 '11 at 7:37 Updated my answer. – khmarbaise Aug 18 '11 at 7:48.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions