Hi everyone,

This is certainly a very dumb question but I have trouble accessing my 
resources that are located in the src/resource directory.

In my code, to load an image, I do:
ImageIO.read(getClass().getResourceAsStream("/myImage.png"))

When Maven packages my software, it puts everything in the resource directory 
at the root of the JAR file.
So when I use my software from another code, including the jar in the 
classpath, it works.
But if I use my software as a standalone application (without packaging it in a 
jar file), it can't find the image (which is logical because the file in not at 
the same place than in the jar).

How do you solve this problem ? Do I really have to run my app from the jar ? 
How can I configure Eclipse (with m2eclipse plugin installed) to run my code 
correctly ?

Thank you
Benoît


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to