java.security.AccessControlException: access denied
(java.util.PropertyPermission * read,write)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:267)
at java.security.AccessController.checkPermission(AccessController.java:394)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:540)
at java.lang.SecurityManager.checkPropertiesAccess(SecurityManager.java:1241)
at java.lang.System.getProperties(System.java:483)
I've tried putting
permission java.util.PropertyPermission "*", "read,write";
into my .java.policy file in my home directory, and in every other
policy file I can find on my system, but with the same result. I've
also tried accessing one of the default properties (e.g.
file.seperator) directly, but get the exception:
java.security.AccessControlException: access denied
(java.util.PropertyPermission file.seperator read)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:267)
at java.security.AccessController.checkPermission(AccessController.java:394)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:540)
at java.lang.SecurityManager.checkPropertyAccess(SecurityManager.java:1273)
at java.lang.System.getProperty(System.java:555)
This is one of the properties that should be available to all applets!
The only thing I can think of is that the system is trying to locate a
policy file in a location that doesn't have one, and so is using
defaults. Is there any way of telling if a policy file is being used,
and if so which one, and if not where it's looking?
Thanks in advance for any help.
Jon
If you really tried file.seperator, try again with file.separator.
--Mike Amling
Open the file C:\j2sdk1.4.1\jre\lib\security\java.security and verify if
there are
folowing lines:
policy.url.1=file:${java.home}/lib/security/java.policy
policy.url.2=file:${user.home}/.java.policy
This is the searching order for policy files.
The first line looks for java.policy in the JRE directory.
The second looks in the user home directory.
Next add following lines to your user .java.policy file.
grant codeBase "file:/c:/yourpath/to/the/applet" {
permission java.util.PropertyPermission "*", "read, write";
};
when you view the applet from your file system or:
grant codeBase "http://www.yourdomain.org/yourpath/to/the/applet" {
permission java.util.PropertyPermission "*", "read, write";
};
in the case of access to a web server.
Cheers
Artur Wystub
http://artur.wystub.bei.t-online.de
-----------------------------------------------------------
I checked the java.security file and the settings for policy.url.x
were as you suggested. I also tried adding the grant for the codebase
but this made no difference. I actually had the grant:
permission java.util.PropertyPermission "*", "read, write";
in my default permissions granted to all domains. I'm stumped...
Thanks for your help so far. Any further suggestions gratefully
received.
Cheers
Jon