I use maven and have a textfile in a sourcefolder called src/main/resources
when I try to load a file from within the folder on my local system it works well
BufferedReader reader = new BufferedReader(new InputStreamReader(this.getClass().getResourceAsStream("/stopwords_german.txt")));
but as soon as I export the project as Runnable Jar in Eclipse and start the jar on my Server I get a Nullpointer exception
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:622)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: java.lang.NullPointerException
at java.io.Reader.<init>(Reader.java:78)
at java.io.InputStreamReader.<init>(InputStreamReader.java:72)
at de.test.dataminer.helper.FilterText.initStopwords(FilterText.java:43)
It's the line with the BufferedReader.
I saw very similar questions here but nothing worked out so for that I tested to fix it (like to try with classloader). Anyone a pointer?
<resources>
<resource>
<directory>/home/johnny/workspace/dataminer/src/main/resources</directory>
</resource>
</resources>