您如何检查应用程序是否有权读取或写入文件系统上的特定目录。我正在尝试这个:
try {
AccessController.checkPermission(new FilePermission(files[i]
.getAbsolutePath(), "read,write"));
}
catch (Exception e) {
System.out.println(e.toString());
}
但它总是抛出异常并输出:
java.security.AccessControlException: access denied ("java.io.FilePermission" "C:\Dell" "read")
java.security.AccessControlException: access denied ("java.io.FilePermission" "C:\Documents and Settings" "read")
java.security.AccessControlException: access denied ("java.io.FilePermission" "C:\glut-3.7.6" "read")
我在这里缺少什么吗?