Java tutorial
import java.io.IOException; import java.nio.file.FileSystems; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.attribute.UserPrincipalLookupService; public class Main { public static void main(String[] args) throws IOException { UserPrincipalLookupService lookupService = FileSystems.getDefault().getUserPrincipalLookupService(); Path path = Paths.get("c:/"); Files.setOwner(path, lookupService.lookupPrincipalByName("joe")); } }