提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
检查符号链接
/*来自 n o w j a v a . c o m*/ import java.nio.file.FileSystems; import java.nio.file.Files; import java.nio.file.Path; public class Main { public static void main(String[] args) { Path link = FileSystems.getDefault().getPath("test"); Path target = FileSystems.getDefault().getPath("C:/folder1/photos", "test.jpg"); // check if a path is a symbolic link - solution 1 boolean link_isSymbolicLink_1 = Files.isSymbolicLink(link); boolean target_isSymbolicLink_1 = Files.isSymbolicLink(target); System.out.println(link.toString() +