Tuesday, December 17, 2013

Tip of the Day: AccessControlException - userTimezone


Problem:
While opening the a java applet, you face below exception



Cause:
The java.policy file present in the java installed directory to which Java TM plugin is pointing is not having permission to write user.timezone value.
Solution:
1.       Locate the java.policy file of Java TM browser plugin
1.1.    The link “http://www.javatester.org/version.html” says about how to find java version, however I am still looking for the exact way to locate java.policy file which is being referred by Java TM browser plugin.
1.2.    This file is present in java installed directory, e.g. C:\Program Files (x86)\Java\jre7\lib\security
1.3.    If you are not sure about the location then I will suggest you to add grant in all the java.policy files present in your computer in all the drives.
2.       Add below entry in “grant {….}”, this is the last grant snippet in the file.
2.1.    permission java.util.PropertyPermission "user.timezone", "write";


I am not going into the details of security implications of this setting, so please do your own due diligence on whether this quick fix will suffice in your own situation. 

Thanks to Vikrant Korde for today's Tip!