我正在尝试在 Ubuntu 12.04 上读/写文件。我通过 chmod -R 777 设置了该目录的权限。但是当我在该目录上调用 canRead() 方法时,它仍然返回 false。
我的目录是 /root/Temp
请帮我解决这个问题
代码(从评论复制):
File xyz = new File("/root/Temp");
System.out.println("filename :"+xyz.getPath());
System.out.println("can read :"+xyz.canRead());
String[] children = xyz.list();
孩子们是null
,可以阅读的输出是false
。