GetResourceAsStream generates java.io.IOException: Root not accessible
-
28-09-2019 - |
Question
InputStream is = this.getClass().getResourceAsStream("/ParseExample/service1.xml");
The code above generates a java.io.IOException: Root is not accessible.
This is the structure of the project folder http://www.fileden.com/files/2010/5/28/2872707//projectfiles.JPG
How can I properly locate the file? What path should be used?
Solution
You need to put the files in the /res folder in your jar, see this example.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow