In the default Policy
implementation, code trying to write files must be granted the specified
permission by a "policy entry" (sometimes referred to as a
"grant entry") in a policy configuration file. The Policy Tool
can be used to create such an entry in such a file.
The Policy Tool is
distributed with the plug-in java (i.e. C:\Program
Files\Java\j2re1.4.0_03\bin\policytool.exe).
- To Launch the Policy Tool double-click the
file from windows explorer.
- To open the policy configuration file of
applets, use the Open command in the File menu. This will
present you with an Open dialog, which you can use to navigate the
directory structure. Select the file .java.policy
in your user profile folder (i.e. C:\Documents and Settings\”your
user login”\) or if it doesn’t exist the file java.policy in the directory lib\security of your java
plug-in (i.e. C:\Program Files\Java\j2re1.4.0_03\lib\security), then
select the Open button.
- To modify the policy entry, select the entry
"Codebase <ALL>", then select
the Modify Policy Entry button in the main "Policy Tool"
window.
- Select the Modify Policy Entry
button in the main "Policy Tool" window. This brings up the Policy dialog box.
- To add the first permission, select the Add
Permission button. This brings up the "Permissions" dialog
box. Do the following:
- Select "File Permission" from
the "Permission:" drop-down list. The complete permission type
name (java.io.FilePermission) now appears in
the text box to the right of the drop-down list.
- Select "<<ALL FILES>> from the list labeled "Target
Name:".
- Specify write access by selecting
"write" from the "Actions:" drop-down list.
Now the "Permission" dialog box looks
like the following:
- Select the OK button. The new
permission appears in a line in the "Policy Entry" dialog.
- You are now done specifying this policy
entry, so select the Done button in the
"Policy Entry" dialog.
- To save the user policy file, select the Save
As command from the File menu and save the new policy with name
.java.policy in your user profile folder (i.e.
C:\Documents and Settings\”your user login”\).