I am doing the following:
How do I get the name of a file's owner in Java on OSX?
Here is my code:
private String getOwner(File f)
{
Path p = Paths.get(f.getAbsolutePath());
UserPrincipal owner = Files.getOwner(p);
return owner.getName();
}
I get a "cannot find symbol" error. Here it is:
...$ javac Delete.java
Delete.java:38: error: cannot find symbol
UserPrincipal owner = Files.getOwner(p);
^
symbol: class UserPrincipal
location: class Delete
1 error
I know what the error means and I have tried several import statements:
java.security.*; (http://docs.oracle.com/javase/7/docs/api/)
java.nio.file.attribute; (http://docs.oracle.com/javase/7/docs/api/)
I feel ridiculous even having to ask this but I have no idea what I could be doing wrong!