I have a program that makes use of getClass().getClassLoader().getResource()
to obtain an URL to a directory, it works fine when in eclipse , but after jared , it returns null.
According to this url : http://www.coderanch.com/t/385935/java/java/getResource-path-fails-Jar
The problem resulted because the path itself did not exist in the jar. The files with the path existed, but not the path itself. I was using the "Runnable JAR File" export command in Eclipse. When I tried the older export "Jar File" to create the jar, I noticed a check box for "add directory entries" and that was the solution. The Jar file needed the directory entry by itself in the jar for getResource() to return the URL for the path.
But in maven , I cannot find such commands to "add directory entries" when packaging , can someone give me a hint ? Thanks a lot !
Env : eclipse 3.5 , m2eclipse , maven 2.2.1