`
japankn
  • 浏览: 214954 次
  • 性别: Icon_minigender_1
  • 来自: 广西
社区版块
存档分类
最新评论

java.security.AccessControlException: access denied 的解决方法

    博客分类:
  • j2se
 
阅读更多

 java.security.AccessControlException: access denied 

解决方案有两个:

1,通过签名来解决:

2,通过更改java/lib/security/java.‍policy(注意jdk和jre的都改,保险)文件来实现。当然这种方式肯定不安全。具体做法是:将下面内容添加到java.policy文件中: 

permission java.lang.RuntimePermission "accessClassInPackage.sun.jdbc.odbc"; 
permission java.util.PropertyPermission "file.encoding", "read"; 
permission   java.util.PropertyPermission   "user.dir ",   "read "; 
permission   java.util.PropertyPermission   "user.home ",   "read "; 
permission   java.util.PropertyPermission   "java.home ",   "read "; 
permission   java.util.PropertyPermission   "java.class.path ",   "read "; 
permission   java.util.PropertyPermission   "user.name ",   "read "; 
permission   java.lang.RuntimePermission   "accessClassInPackage.sun.misc "; 
permission   java.lang.RuntimePermission   "accessClassInPackage.sun.audio "; 
permission   java.lang.RuntimePermission   "modifyThread "; 
permission   java.lang.RuntimePermission   "modifyThreadGroup "; 
permission   java.lang.RuntimePermission   "loadLibrary.* "; 
permission   java.io.FilePermission   " < <ALL   FILES> > ",   "read "; 
permission   java.io.FilePermission   "${user.dir}${/}jmf.log ",   "write "; 
permission   java.io.FilePermission   "${user.home}${/}.JMStudioCfg ",   "write "; 
permission   java.net.SocketPermission   "* ",   "connect,accept "; 
permission   java.io.FilePermission   "C:\WINNT\TEMP\* ",   "write "; 
permission   java.io.FilePermission   "C:\WINNT\TEMP\* ",   "delete "; 
permission   java.awt.AWTPermission   "showWindowWithoutWarningBanner "; 
permission   javax.sound.sampled.AudioPermission   "record "; 
permission   java.net.SocketPermission   "- ",   "listen "; 
permission   java.net.SocketPermission   "- ",   "accept "; 
permission   java.net.SocketPermission   "- ",   "connect "; 
permission   java.net.SocketPermission   "- ",   "resolve "; 
permission   java.security.AllPermission;

 

再关闭浏览器重新运行
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics