我正在执行以下操作:
这是我的代码:
private String getOwner(File f)
{
Path p = Paths.get(f.getAbsolutePath());
UserPrincipal owner = Files.getOwner(p);
return owner.getName();
}
我收到“找不到符号”错误。这里是:
...$ javac Delete.java
Delete.java:38: error: cannot find symbol
UserPrincipal owner = Files.getOwner(p);
^
symbol: class UserPrincipal
location: class Delete
1 error
我知道错误的含义,并且尝试了几个导入语句:
java.security.*; ( http://docs.oracle.com/javase/7/docs/api/ )
java.nio.file.attribute; ( http://docs.oracle.com/javase/7/docs/api/ )
即使不得不问这个我也觉得很荒谬,但我不知道我做错了什么!