Under Java Security Manager, accessing a file inside a jar
Sandeep P Kulkarni
Joined: Sep 28, 2007
How to read a file[resource] inside jar under Java Security Manager? Ex- in myApp.jar , I want to read file placed under com/mystuff/queries/abc.sql myApp.jar | |-com/mystuff/queries/abc.sql
I am using Class.class.getResourceAsStream("")to read the content of a file which is packaged inside a jar. This works fine if not run under Java Security manager. This fails under Java Security Manager. I am getting a NULL InputStream under security manager. Probably I need to give "read" permission to "queries" folder recursively.
What is the syntax to be used in policy file to give permission recursively to folder inside a jar?
OR Please let me know if this is the correct syntax-
Joined: Aug 10, 2005
Here's a copy of an entry from my .java.policy file: