使用FileOwnerAttributeView.getOwner()获取文件所有者
import java.io.IOException;/** 来自 n o w j a v a . c o m - 时 代 Java**/ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.attribute.FileOwnerAttributeView; public class Main { public static void main(String[] args) { Path path = Paths.get("C:/folder1/folder2/folder4", "test.txt"); FileOwnerAttributeView foav = Files.getFileAttributeView(path, FileOwnerAttributeView.class); try { String owner = foav.getOwner().getName();