Hi! I am working in a project and I need a resource in it. I am trying to get it using this code:
InputStream is = JSONParser.class.getResourceAsStream("a.json");
String jsonTxt = IOUtils.toString( is );
The file a.json is located in the main file of the project.
The exact problem is:
Exception in thread "main" java.lang.NullPointerException
at java.io.Reader.(Reader.java:61)
at java.io.InputStreamReader.(InputStreamReader.java:55)
at org.apache.commons.io.IOUtils.copy(IOUtils.java:1049)
at org.apache.commons.io.IOUtils.toString(IOUtils.java:359)
at com.playence.parser.JSon.main(JSon.java:28)
Debugging, I saw that variable 'is' is null, and I guess that is why NullPointException, bugt I don't know how to solve it.
Any help?
Thans in advance.