Java开发网 |
注册 |
登录 |
帮助 |
搜索 |
排行榜 |
发帖统计
|
您没有登录 |
» Java开发网 » Java SE 综合讨论区
打印话题 寄给朋友 订阅主题 |
作者 | Re:怎样可以令Java Applet有权存取档案? [Re:manwk] |
taogang
怡然如故 发贴: 209 积分: 61 |
于 2003-02-12 17:37
Default Policy Files and Their Locations There is by default a single system-wide policy file, and an optional user policy file. The system policy file is by default located at java.home\lib\security\java.policy Here, java.home is the runtime environment's directory (the jre directory in the SDK or the top-level directory of the Java 2 Runtime Environment). The user policy file is by default located at user.home\.java.policy Here, user.home indicates the user's home directory. When the Policy is initialized, the system policy is loaded in first, and then the user policy is added to it. If neither policy is present, a built-in policy is used. This built-in policy is the same as the original sandbox policy. Policy file locations are specified in the security properties file, which is located at java.home\lib\security\java.security The policy file locations are specified as the values of properties whose names are of the form policy.url.n Here, n indicates a number. You specify each such property value in a line of the following form: policy.url.n=URL Here, URL is a URL specification. For example, the default policy files, sometimes referred to as the "system" and "user" policy files, respectively, are defined in the security properties file as policy.url.1=file:${java.home}/lib/security/java.policy policy.url.2=file:${user.home}/.java.policy Note: when a string like ${some.property} appears in a policy file, or in the security properties file, it will be expanded to the value of the specified system property. For example, ${java.home} indicates the value of the java.home property specifying the runtime environment's directory (the jre directory in the SDK or the top-level directory of the Java 2 Runtime Environment). Whether or not property expansion is allowed is controlled by the value of the "policy.expandProperties" property in the security properties file. If the value of this property is true (the default), expansion is allowed. You can actually specify a number of URLs in the security properties file (including ones of the form "http://"), and all the designated policy files will get loaded. You can also comment out or change the second one to disable reading the default user policy file. The algorithm starts at policy.url.1, and keeps incrementing until it does not find a URL. Thus if you have policy.url.1 and policy.url.3, policy.url.3 will never be read. It is also possible to specify an additional or a different policy file when invoking execution of an application. This can be done via the "-Djava.security.policy" command-line argument, which sets the value of the java.security.policy property. For example, if you type the following, where pURL is a URL indicating the location of a policy file, then the specified policy file will be loaded in addition to all the policy files that are specified in the security properties file. java -Djava.security.manager -Djava.security.policy=pURL SomeApp (The "-Djava.security.manager" argument ensures that the default security manager is installed, and thus the application is subject to policy checks. It is not required if the application SomeApp installs a security manager.) If you instead type the following, using a double equals, then just the specified policy file will be used; all others will be ignored. java -Djava.security.manager -Djava.security.policy==pURL SomeApp If you want to pass a policy file to the appletviewer, again use a "-Djava.security.policy" argument as follows: appletviewer -J-Djava.security.policy=pURL myApplet Please note: The "-Djava.security.policy" policy file value will be ignored (for both java and appletviewer commands) if the "policy.allowSystemProperty" property in the security properties file is set to false. The default is true.
taogang edited on 2003-02-12 17:40
关于 异常 。。。。 谢谢指教 |
话题树型展开 |
人气 | 标题 | 作者 | 字数 | 发贴时间 |
7479 | 怎样可以令Java Applet有权存取档案? | manwk | 52 | 2003-02-08 12:41 |
7159 | Re:怎样可以令Java Applet有权存取档案? | taogang | 3914 | 2003-02-12 17:37 |
7164 | read more info at : | taogang | 108 | 2003-02-12 17:39 |
7597 | Re:怎样可以令Java Applet有权存取档案? | linux_china | 20 | 2003-02-13 20:51 |
6618 | Re:怎样可以令Java Applet有权存取档案? | R7733251 | 246 | 2003-02-15 10:59 |
已读帖子 新的帖子 被删除的帖子 |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |