Skip to content

Latest commit

 

History

History
71 lines (55 loc) · 2.54 KB

README.md

File metadata and controls

71 lines (55 loc) · 2.54 KB

TODO

  • VIRT-java程序VIRT过大问题.md

java集合

Map

LinkedHashMap

java 死锁

通过MXBean程序查找死锁

Java 安全模型介绍

给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;
  }
});

命令

jar

$ 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

其他