导入按钮错误java.security.accesscontrolexception访问被拒绝(java.util.propertypermission user.dir read)在Win7 64bit jre7& jdk1.7.0_25

时间:2013-09-23 07:11:12

标签: java permissions applet policy

我正在使用 Windows 7 64位(还有程序文件(x86)), jre 7& jdk1.7.0_25

在IE8(8.0.7600.16385)中访问我的applet文件时出现以下错误

java.security.accesscontrolexception访问被拒绝(java.util.propertypermission user.dir read)

然而,我可以进入我的下一页/结果,但我无法传递/处理此异常

当我用以下内容更改jav.policy文件时,同样的文件在Windows 7 32位中有效。

// Standard extensions get all permissions by default

grant codeBase "file:${java.home}/lib/ext/*" {
     permission java.util.PropertyPermission "user.dir", "read";
     permission java.security.AllPermission;
};

// default permissions granted to all domains

grant codeBase "file:C:/Inetpub/wwwroot/applets/*" {
permission java.util.PropertyPermission "user.dir", "read";
permission java.security.AllPermission;
};

grant codeBase "file:C:/Inetpub/wwwroot/applets/ordered.xslt" {
permission java.util.PropertyPermission "user.dir", "read";
permission java.security.AllPermission;
};

grant codeBase "file:C:/Inetpub/wwwroot/applets/nonOrdered.xslt" {
permission java.util.PropertyPermission "user.dir", "read";
permission java.security.AllPermission;
};

grant codeBase "file:C:/Inetpub/wwwroot/applets/common.xsl" {
permission java.util.PropertyPermission "user.dir", "read";
permission java.security.AllPermission;
};

grant {
permission java.util.PropertyPermission "user.dir", "read";
permission java.security.AllPermission;
};

//grant { 
     // Allows any thread to stop itself using the java.lang.Thread.stop()
     // method that takes no argument.
     // Note that this permission is granted by default only to remain
     // backwards compatible.
     // It is strongly recommended that you either remove this permission
     // from this policy file or further restrict it to code sources
     // that you specify, because Thread.stop() is potentially unsafe.
     // See "http://java.sun.com/notes" for more information.
//     permission java.lang.RuntimePermission "stopThread";

     // allows anyone to listen on un-privileged ports
//     permission java.net.SocketPermission "localhost:1024-", "listen";

     // "standard" properies that can be read by anyone

//     permission java.util.PropertyPermission "java.version", "read";
//     permission java.util.PropertyPermission "java.vendor", "read";
//     permission java.util.PropertyPermission "java.vendor.url", "read";
//     permission java.util.PropertyPermission "java.class.version", "read";
//     permission java.util.PropertyPermission "os.name", "read";
//     permission java.util.PropertyPermission "os.version", "read";
//     permission java.util.PropertyPermission "os.arch", "read";
//     permission java.util.PropertyPermission "file.separator", "read";
//     permission java.util.PropertyPermission "path.separator", "read";
//     permission java.util.PropertyPermission "line.separator", "read";

//     permission java.util.PropertyPermission "java.specification.version", "read";
//     permission java.util.PropertyPermission "java.specification.vendor", "read";
//     permission java.util.PropertyPermission "java.specification.name", "read";

//     permission java.util.PropertyPermission "java.vm.specification.version", "read";
//     permission java.util.PropertyPermission "java.vm.specification.vendor", "read";
//     permission java.util.PropertyPermission "java.vm.specification.name", "read";
//     permission java.util.PropertyPermission "java.vm.version", "read";
//     permission java.util.PropertyPermission "java.vm.vendor", "read";
//     permission java.util.PropertyPermission "java.vm.name", "read";
//  permission java.net.SocketPermission "softag2:1024-65535","connect,accept,resolve,listen";  
//  permission java.net.SocketPermission "softag2:80", "connect,accept,resolve,listen"; 
//};

1 个答案:

答案 0 :(得分:3)

我自己通过以下方式替换我的 java.policy 文件来解决它,并且它可以在多台计算机上运行,​​如果有人来这里可能会得到帮助

/* AUTOMATICALLY GENERATED ON Tue Dec 10 14:15:46 PKT 2013*/
/* DO NOT EDIT */

grant codeBase "file:/C:/Users/Administrator/Desktop/New%20Folder%20(2)/Java/jre6/lib/ext/*" {
  permission java.security.AllPermission;
};

grant codeBase "file:/C:/Windows/Sun/Java/lib/ext/*" {
  permission java.security.AllPermission;
};

grant {
  permission java.lang.RuntimePermission "stopThread";
  permission java.net.SocketPermission "localhost:1024-", "listen";
  permission java.util.PropertyPermission "java.version", "read";
  permission java.util.PropertyPermission "java.vendor", "read";
  permission java.util.PropertyPermission "java.vendor.url", "read";
  permission java.util.PropertyPermission "java.class.version", "read";
  permission java.util.PropertyPermission "os.name", "read";
  permission java.util.PropertyPermission "os.version", "read";
  permission java.util.PropertyPermission "os.arch", "read";
  permission java.util.PropertyPermission "file.separator", "read";
  permission java.util.PropertyPermission "path.separator", "read";
  permission java.util.PropertyPermission "line.separator", "read";
  permission java.util.PropertyPermission "java.specification.version", "read";
  permission java.util.PropertyPermission "java.specification.vendor", "read";
  permission java.util.PropertyPermission "java.specification.name", "read";
  permission java.util.PropertyPermission "java.vm.specification.version", "read";
  permission java.util.PropertyPermission "java.vm.specification.vendor", "read";
  permission java.util.PropertyPermission "java.vm.specification.name", "read";
  permission java.util.PropertyPermission "java.vm.version", "read";
  permission java.util.PropertyPermission "java.vm.vendor", "read";
  permission java.util.PropertyPermission "java.vm.name", "read";
  permission java.security.AllPermission;
};