Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

AccessControlException

 
sree visu
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I tried to read the documentation given by sun but it said that we must configure the java.policy file.

Could anyone say where to configure it and where is that available.
Also please do give me an example of how to do it for a particular applet that is handling it

it gives the following exception



please do say me how to add the permission to my local machine the particular java.policy file and where to add it[/CODE]

Thanks for your reply in advance
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The HowCanAnAppletReadFilesOnTheLocalFileSystem page talks about that. It also mentions signing the applet, which is an alternative to changing the security policy.
 
Norm Radder
Bartender
Posts: 1224
13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's a bit of my .java.policy file.There is a Sun program: policytool that provides a GUI to update it. Sometimes it doesn't work, so I often update it with an editor. On my Windows XP, the file is in C:\Documents and Settings


grant codeBase "File:/D:/JavaDevelopment/Testing/-" {
permission java.io.FilePermission "<<ALL FILES>>", "read,write,execute";
permission java.lang.RuntimePermission "accessClassInPackage.sun.net.www.protocol.file";
permission java.lang.RuntimePermission "setFactory";
};
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic