Quick Tour of Controlling Applications |
To grant theGetProps
application permission to read the"user.home"
and"java.home"
property values, you must create a policy entry granting this permission.Select the Add Policy Entry button in the main "Policy Tool" window. This brings up the "Policy Entry" dialog box:
Type the following file URL into the CodeBase text box to indicate you are going to be granting a permission to code from the specified directory, which is the directory in which
GetProps.class
is stored:(Note, this is a URL and thus must always have slashes, not backslashes.)file:/C:/Test/Leave the SignedBy text box blank, since you aren't requiring the code to be signed.
To add permission to read the
Do the following:"user.home"
property value, select the Add Permission button. This brings up the "Permissions" dialog box:Now the "Permissions" dialog box looks like the following:
- Select Property Permission from the "Permission:" drop-down list. The complete permission type name (
java.util.PropertyPermission
) now appears in the text box to the right of the drop-down list.
- Type the following in the text box to the right of the list labeled "Target Name:" to specify the
"user.home"
property:user.home- Specify permission to read this property by selecting read from the "Actions:" drop-down list.
Select the OK button. The new permission appears in a line in the policy entry window:
To add permission to read the
"java.home"
property value, select the Add Permission button again. In the "Permissions" dialog box, do the following:Now the "Permissions" dialog box looks like the following:
- Select Property Permission from the "Permission:" drop-down list.
- Type the following in the text box to the right of the list labeled "Target Name:" to specify the
"java.home"
property:java.home- Specify permission to read this property by selecting read from the "Actions:" drop-down list.
Select the OK button. The new permission and the previously-added permission appear in lines in the policy entry window:
You are now done specifying this policy entry, so select the Done button in the "Policy Entry" dialog. The "Policy Tool" window now includes a line representing the new policy entry, showing the CodeBase value:
Quick Tour of Controlling Applications |