使用-Djava.security.policy=xxx.policy启动安全策略, 你会想到codesource的配置如此蛋疼么?
grant CodeBase "file:////D:/SourceDemo/demo/src/main/Friend.jar"{
permission java.io.FilePermission "D:/-","read";
};
grant CodeBase "file:/D:/SourceDemo/demo/src/main/java/"{
permission java.io.FilePermission "D:/-","read";
};
(1)可以file:/D:/xxxx
(2)不可以file://D:/xxx
(3)可以file:///D:/xxx
(4)可以file:////D:/xxx
....
亮点在(2)