Documentation

The Java™ Tutorials
Hide TOC
Set up a Policy File to Grant the Required Permission设置策略文件以授予所需权限
Trail: Security Features in Java SE
Lesson: Creating a Policy File

Set up a Policy File to Grant the Required Permission设置策略文件以授予所需权限

A policy file is an ASCII text file and can be composed via a text editor or the graphical Policy Tool utility demonstrated in this section. The Policy Tool saves you typing and eliminates the need for you to know the required syntax of policy files, thus reducing errors.策略文件是ASCII文本文件,可以通过文本编辑器或本节中演示的图形策略工具实用程序进行组合。策略工具为您节省了键入时间,并消除了您了解策略文件所需语法的需要,从而减少了错误。

This lesson uses the Policy Tool to create a policy file named examplepolicy, in which you will add a policy entry that grants code from the examples directory permission to write.本课程使用策略工具创建一个名为examplepolicy的策略文件,您将在其中添加一个策略条目,授予examples目录中的代码写入权限。

Follow these steps to create and modify your new policy file:按照以下步骤创建和修改新策略文件:

  1. Start Policy Tool启动策略工具
  2. Grant the Required Permission授予所需权限
  3. Save the Policy File保存策略文件

Note for UNIX Users: The steps illustrate creating the policy file for a Windows system. 这些步骤说明了如何为Windows系统创建策略文件。The steps are exactly the same if you are working on a UNIX system. Where the text says to store the policy file in the C:\Test directory, you can store it in another directory. 如果您在UNIX系统上工作,步骤完全相同。如果文本指示将策略文件存储在C:\Test目录中,则可以将其存储在另一个目录中。The examples in the lesson Quick Tour of Controlling Applications assume that you stored it in the ~/test directory. “控制应用程序快速教程”课程中的示例假定您将其存储在~/test目录中。

Previous page: Creating a Policy File
Next page: Start Policy Tool