grant {
permission java.io.FilePermission "C:\\class\\*", "read, write";
permission java.lang.RuntimePermission "createClassLoader";
};
我的政策.txt
java.security.AccessControlException: access denied (java.io.FilePermission c:\class read)
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkRead(Unknown Source)
at java.io.File.isDirectory(Unknown Source)
at java.io.File.toURI(Unknown Source)
at loader.Main.main(Main.java:35)
我的例外..???
我的电话
String path = "c:\\class\\";
String app = "x.MyHTMLPrint";
File file = new File(path);
URL url = file.toURI().toURL();
URL[] urls = new URL[]{url};
ClassLoader cl = new URLClassLoader(urls);
Class cls = cl.loadClass(app);
只要我给予它完全许可,它就可以工作。
有任何想法吗?谢谢!