In my project I access the folder that is in /src/main/ressources/Mylib
in eclipse it works well without any problem, but when i export the project into .jar file it does not work.
The line of code that bug:
File fi = new File(Testp.class.getClassLoader().getResource("Mylib/").getFile());
and it gives this bug:
Exception in thread "main" java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:61)
Caused by: java.lang.NullPointerException
at com.myproject.Testp.main(Testp.java:73)
... 5 more