|
8.12.1 Using Policy Tool
Policy tool is a java tool that helps you to overcome the applet restrictions. You can use the Policy Tool to create and modify the external policy configuration files that define your installation's security policy. It can be invoked either through the Bean Builder or by issuing the policytool command from the command prompt.
If your application is of Build type Applet, they have a security restrictions in them. You must define a Java Policy to overcome the security restrictions imposed by java, to run the application.
The Steps on how to create a Policy and specify it for your application are explained in the steps below.
Open the Bean Builder tool.
Go to the tools menu.
Click on the policy tool menu item.
This will invoke the java policy tool. On opening it might complain saying some policy file doesn't exist. Ignore the message.
Click on the Add Policy Entry button.
This will invoke another frame named policy entry. Click the button named Add Permission. This invokes another dialog named Permissions.
Click on the ComboBox which has a starting item named Permission:
From the drop down list select AllPermission and click ok.
Click done in the policy entry frame.
Now finally the Policy tool is left. Click on the File menu and select save as menuitem.
This invokes a save dialog. Enter the name of the file say mypolicy. (Remember this name as you have to use this policy file).
Now you have completed setting up the permissions file. Then you have to tell the application that it has to use this policy file while running. So follow the steps given below to give permission to your application.
Go the Properties menu in the Bean Builder tool and invoke the Project Properties menu item.
This brings up the Project Properties dialog. In the dialog select the runsetup tab.
In the screen currently displayed click the button beside the java variables.
This invokes a dialog titled Java Param.
Now in the left side of the screen there is combobox with first item showing as JAVA. Click the combobox and select SECURITY.
Now click on the combobox on the right side with first item showing as Options and select -Djava.security.policy.
Now the final step is in the field beside the value label type in the name of the policy file that you have saved.
Now click ok and come out of the Project Properties.
Now you have finished giving permission to your application. Finally test your application as applet. It will not complain about any access denied errors.
Thus you can define the policy to overcome the java's restrictions using this tool. To know more about the tool refer to http://java.sun.com/docs/books/tutorial/security1.2/toolsign/wstep1.html
You can have further knowledge of the various security tools provided by java in the following link.
http://java.sun.com/products/jdk/1.2/docs/guide/security/SecurityToolsSummary.html
|