I am trying to pack a Java project in a runnable jar using Eclipse (version of Kepler SR2). The project uses Maven (which was imposed on me, and I don’t know much about it). The problem is that the project works fine in Eclipse, but after exporting to Jar it will no longer find any of the necessary resources.
Here is the folder structure:
+src
+main
+java
<packages with source code>
+resources
<folders with static resources>
+test
+java
<unit test classes>
I also added a resource folder to the build path.
Resources are loaded using
File myFile = new File(getClass().getClassLoader().getResource("resourcePath").getPath());
This line works fine when running a program from Eclipse, but when using the executable banner that I created using the "Export> Java> Runnable Jar", it does not work with NPE.
Jar " " " ". .
, Jar?
!
Martin