If you have been a programmer in JAVA, you must have noticed the occurrence of the exception: “java.security.AccessControlException”. Most of us are not much aware of the fact that it is further associated with the denial of the access to the remote machine. Such an exception shows that you are suffering from the policy concerns of Java Development Kit. There are various policies that are pre defined in the JDK which restricts the usage a bit.
Generally it is advised to put the jdk folder outside of the program files or to switch off your firewall, but sometimes it requires more than that. Here’s a screenshot to begin with:
java.security.AccessControlException [SOLVED]
In these easy steps you can solve this problem and it is advised to suppress all the permissions that are by default present whenever we are concerned with the project testing.
Step 1: Create a policy file of yours as shown with .policy extension. Below is an example of the same. Save it with the name policyname.policy
In my case, i kept the policy name hs. Add to the file, the following lines:
[php]
grant
{
permission java.security.AllPermission;
}
[/php]
Step 2: Save this policy file in the C://Users/Username/
You can save it elsewhere too but it is advised to put it in the above mentioned folder. In my case, i saved it as:
C://Users/Heeren/
Step 3: Now head over to:
C:/~/jdk1.6<version>/jre/lib/security
Open up the file named java.security in notepad.
Step 4: Your security file should look like the image below:
Search for the lines (it is better to search on the text wrapping option of the notepad):
[php]
policy.url.1=file:${java.home}/lib/security/java.policy
policy.url.2=file:${user.home}/.java.policy
[/php]
Embed the following line after the policy.url.2 line:
policy.url.3=file: path of the file .policy file that you have created above
In my case it looked like the following (remember the address of policy file saved in Step2):
[php]policy.url.3=file:c:/Users/Heeren/hs.policy[/php]
Now you are good to go through this kind of Access Denial permission. Your feedback and queries are always welcome.
This post is an answer to one of the question posted by our reader. If you also have any programming related questions or technical queries, let us know through our Contact Form.






Terrific work! This is the type of information that should be shared around the web. Shame on the search engines for not positioning this post higher!
Thanks buddy. Just chill. Every start is small but with the cooperation of you people we can increase our counts. I hope that this post will be helpful to you because it took me 7 days to figure out how to handle this situation for my networking related project. Thanks a lot again .