的AccessControlException:拒绝访问 - 的FilePermission [英] AccessControlException: access denied - FilePermission

查看:291
本文介绍了的AccessControlException:拒绝访问 - 的FilePermission的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用JRE7。我已经签署使用的jarsigner的jar文件。但我仍得到的异常

I am using JRE7. I have signed the jar file using jarsigner. But still I get the exception

java.security.AccessControlException: access denied ("java.io.FilePermission" 
    "C:\Program Files\Java\jre7\lib\ext\Cert.P12" "read") 

我想读的Cert.P12存储在该目录中。

I am trying to read the Cert.P12 stored in that directory.

我生成使用密钥工具的证书,并签署了罐子。当浏览器提示我,我接受了证书。是不是因为它不是我收到此错误一个真正的证书吗?

I generated certificate using keytool and signed the jar. When the browser prompted me i accepted the certificate. Is it because it is not a real certificate I am getting this error?

这code读取该文件是一个applet code。

This code to read the file is an applet code.

HTTP://www-personal.umich埃杜/〜lsiden /教程/签署的小程序/签订-applet.html 提到,如果签订的错误就会消失。但它确实不适合我。

http://www-personal.umich.edu/~lsiden/tutorials/signed-applet/signed-applet.html mentions that if it is signed the error will vanish. But it did not for me.

推荐答案

如果,即使签约后的小程序,你仍然可以获得一个SecurityException,尝试运行code作为特权code:

If, even after signing the applet, you still get a SecurityException, try running the code as privileged code:

AccessController.doPrivileged(new PrivilegedAction() {
    public Object run() {
        // perform the security-sensitive operation here
        return null;
    }
});

这篇关于的AccessControlException:拒绝访问 - 的FilePermission的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆