I am trying to package a Java project into a runnable jar using Eclipse (version Kepler SR2). The project is using Maven (which has been fored onto me and I don't know much about it). The problem is that the project runs fine within Eclipse, but after export to Jar it doesn't find any of the required resources anymore.
Here is the folder structure:
+src
+main
+java
<packages with source code>
+resources
<folders with static resources>
+test
+java
<unit test classes>
I have also added the resource folder to the build path.
The resources are loaded using
File myFile = new File(getClass().getClassLoader().getResource("resourcePath").getPath());
This line works perfectly fine when executing the program from Eclipse, but it fails with an NPE when using the executable jar that I created with "Export>Java>Runnable Jar".
I have already to use the standard Jar export with the options "Export generated class files and resources" and "Add directory entries" checked. This leads to the same problem, though.
What do I need to do in order to correctly export the resources into the Jar?
Thanks!
Martin