- VIRT-java程序VIRT过大问题.md
- 1.Entry 是双链表
- 2.Entry可以定义两种顺序:插入顺序和LRU顺序 LinkedHashMapInsertTest LinkedHashMapLRUTest
给classes下的文件赋读写权限
grant codeBase "file:/Users/juntaozhang/GitProj/my-jdk-test/jaas/demo3/classes/*" {
permission "java.io.FilePermission" "/Users/juntaozhang/GitProj/my-jdk-test/jaas/demo3/data/test.txt", "read,write";
};
给classes下的文件赋所有权限
grant codeBase "file:/Users/juntaozhang/GitProj/my-jdk-test/jaas/demo3/classes/*" {
permission java.security.AllPermission;
};
获取权限
1.通过上述的policy
2.通过调用AccessController(前提:该class必须在policy范围内)
AccessController.doPrivileged(new PrivilegedAction<String>() {
@Override
public String run() {
makeFile(fileName);
return null;
}
});
$ javac Hello.java
$ jar -cf hi.jar Hello.class
$ jar -xf hi.jar
$ jar -uf hi.jar Hello.class
$ jar -uf a.jar com/a.class //更新文件到jar中,名录一定要对应
$ jar -uf a.jar com org