Tuesday 4 March 2008

simplest way to config java security policy

In my case, on xp, these security policy files are stored here:
C:\Program Files\Java\jre1.6.0_04\lib\security

So, when applet need to access local or remote file, the "java.policy" should be modified.

Eclipse will generate a very dangerous java.policy.applet by default for testing, you can copy the setting permission line in to java.policy, in this case, your applet can reading files. But it's dangerous.

My way is to put such code in the java.policy. where the path is the place where my applet class file exists.

grant codeBase "file:///D:/My%20Documents/workspace/2008.3.applet/bin/" {
permission java.security.AllPermission;
};

No comments:

My photo
London, United Kingdom
twitter.com/zhengxin

Facebook & Twitter