javapermissionscommentspolicyfiles

Do Java security policy files support comments?


All the documentation I could find for Java security policy files (.policy), together with the examples in it, list only two elements that are allowed in the files (keystore blocks and grant blocks).

I was surprised at the apparent lack of mention of comments, which I'd expect to exist as a third such element. Is there any way to insert comments (i.e. text intended for humans to read, that isn't parsed by the JRE) in a policy file? If there is, what is the syntax?


Solution

  • As far as I understand from this tutorial — https://docs.oracle.com/javase/tutorial/security/userperm/policy.html, you can use line comments starting with //.

    See the file here, there are pretty lots of comments — https://docs.oracle.com/javase/tutorial/security/userperm/examples/kim.policy.