The Java Tutorials have been written for JDK 8.Java教程是为JDK 8编写的。Examples and practices described in this page don't take advantage of improvements introduced in later releases and might use technology no longer available.本页中描述的示例和实践没有利用后续版本中引入的改进,并且可能使用不再可用的技术。See Java Language Changes for a summary of updated language features in Java SE 9 and subsequent releases.有关Java SE 9及其后续版本中更新的语言特性的摘要,请参阅Java语言更改。
See JDK Release Notes for information about new features, enhancements, and removed or deprecated options for all JDK releases.有关所有JDK版本的新功能、增强功能以及已删除或不推荐的选项的信息,请参阅JDK发行说明。
To create a new entry, click the Add Policy Entry button in the main Policy Tool window. This displays the Policy Entry dialog box as shown in the following figure.
A policy entry specifies one or more permissions for code from a particular code source - code from a particular location (URL), code signed by a particular entity, or both.
The CodeBase and the SignedBy text boxes specify which code you want to grant the permission(s) you will be adding in the file.
If you have both a CodeBase and a SignedBy entry, the permission(s) are granted only to code that is both from the specified location and signed by the named alias.
You can grant permission to all code from the location (URL) where examples are stored.
Type the following URL into the CodeBase text box of the Policy Entry dialog box:
https://docs.oracle.com/javase/tutorial/security/tour1/examples/
Note: This is a URL. Therefore, it must always use slashes as separators, not backslashes.
Leave the SignedBy text box blank, since you aren't requiring the code to be signed.
.class
file) not just from the directory specified previously but from the security
directory and its subdirectories, type the following URL into the CodeBase box:
https://docs.oracle.com/javase/tutorial/security/
You have specified where the code comes from (the CodeBase), and that the code does not have to be signed (since there is no SignedBy value).
You have now specified this policy entry, so click the Done button in the Policy Entry dialog. The Policy Tool window now contains a line representing the policy entry, showing the CodeBase
value.
Note: We will be granting permissions to this new policy entry in the next lesson.