部署java.policy
我编写了一些 Java Applet 并将它们捆绑到一个签名的 JAR 中。即使 Applet 已签名,它们仍然需要在客户端上对 java.policy
文件进行一些更改。例如,执行打印作业。
为了帮助最终用户,用户可以下载另一个带有小型 Swing 应用程序的 JAR,该应用程序会将条目添加到其 .java.policy
中。
我的问题:
是否有一个众所周知的库可以部署/交付/安装java.policy
?
小应用程序将简单地附加到.java.policy
。如果运行多次,程序将多次追加相同的数据。如果我只添加一次条目会更好。为此,我必须解析 .java.policy 并写回。是否有任何库可以操作 java.policy 条目?
I have written some Java Applets and bundled them into a signed JAR. Even though the Applets are signed, they still need to be some changes on the client concerning the java.policy
file. For example, to do a print job.
To help the end user, the user can download another JAR with a small Swing app which will add the entries to their .java.policy
.
My questions:
Is there a well known library to deploy/deliver/install java.policy
?
The small application will simply append to the .java.policy
. If run several time, the program will append the same data several times. It would be better if I only add the entry once. For that I have to parse the .java.policy
and write back. Is there any library to manipulate java.policy
entries?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Java 的策略工具可让您操作现有的策略文件(甚至创建新的策略文件)。但它主要面向开发人员。如果您想让它更加用户友好,我想您必须自己编写一个(您应该能够重用标准策略工具中的大量代码)。
Java's Policy Tool lets you manipulate existing policy file (and even create new ones). But it's mostly geared towards developers. If you want to make it more user-friendly, I imagine you would have to write one yourself (you should be able to reuse a lot of the code from the standard policy tool).
我不认为更改本地策略文件是正确的解决方案。通常,您的小程序应在其清单文件中指定所需的权限级别,例如:
<代码>
权限:所有权限
代码库:*
仅可信: true
有关下一页的更多信息,请参阅“权限属性”
https://docs.oracle.com/javase/8/docs/technotes/guides/deploy/manifest.html#A1148525
小程序也需要签名。
I don't think changing local policy files is the correct solution. Normally your applet should name the required permission level in its manifest file, e.g.:
Permissions: all-permissions
Codebase: *
Trusted-Only: true
More on the follwing page, see "Permissions Attribute"
https://docs.oracle.com/javase/8/docs/technotes/guides/deploy/manifest.html#A1148525
The applet needs to be signed as well.