2
grant {
    permission java.security.AllPermission;
};

这行得通。

grant file:///- {
    permission java.security.AllPermission;
};

这不起作用。有人可以向我解释为什么吗?

4

2 回答 2

2

语法应该是:

授予 codeBase "file:///-" {
   ...
};

请参阅文档。注意分号。

为代码分配权限时要非常小心。

您确定代码库应该是文件 URL(正常用于开发,不适用于生产......)。

于 2008-10-02T13:59:08.133 回答
1

The directive "grant { permission }" means grant the permission to all code no matter where it came from. In other words, when there is no codebase specified, the code could be loaded from the network or the file system.

The second directive (if it worked) would only apply to the local file system. It would be specifying all files (recursively) on the local file system. I'm not sure that "file:///" is a valid URL by itself. I know that file:///tmp/- works.

于 2008-10-01T21:14:33.183 回答