Anyway here is the arcane part you are interested in.
The applet security policy is stored in the user's home directory in a file called .java.policy. Here is a wide open policy which probably should not be used except when absolutely necessary. You can comment the policy out using the /* */ syntax when it is not necessary.
grant { permission java.security.AllPermission; };
A more conservative approach would be to use something like this for testing from your localhost development system. The trailing "-" indicates any sub-directory from the top level.
grant codeBase "http://localhost/-" { permission java.security.AllPermission; };
This allows you to do wide open development and testing, but keeps the permissions limited from code outside of the current machine.
I have attached a NetBeans 6.9 project which includes code from Oracle which demonstrates the Java Security Manager. WriteFileApplet.zip
No comments:
Post a Comment