Reputation: 1
File file = new File(getClass().getResource(filePath + "/createFile.xml").toURI());
I get an error of java.lang.NullPointerException
in above line. Here filePath
is string variable in which I have set my directory path from where I want to read file.
Upvotes: 0
Views: 292
Reputation: 20760
Class.getResource()
will return null
when the resource was not found. You always should test for that before using it.
Upvotes: 1