检查路径是否为符号链接
import java.io.IOException; import java.nio.file.FileSystems;//时 代 J a v a - nowjava.com 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", "my_winner.jpg"); try { Boolean link_isSymbolicLink_2 = (Boolean) Files.getAttribute(link, "basic:isSymbolicLink"); Boolean target_isSymbolicLink_2 = (Boolean) Files.getAttribute(target, "basic:isSymbolicLink"); /** from * nowjava.com - 时 代 Java **/ System.out.println(link.toString() + " is a symbolic link ? " + link_isSymbolicLink_2); System.out.println(target.toStrin