从路径字符串创建路径
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 HardLink { /* Create a hard link: Windows: mklink /H newlinkfolder targetfolder linux: ln targetfolder newlinkfolder */ public static void main(String[] args) { Path link = FileSystems.getDefault().getPath("D:/intro/new"); Path target = FileSystems.getDefault().getPath("C:/Users"); try { //Files.createLink Files.createLink(link, target); } catch (IOException | UnsupportedOperationException e) { e.printStackTrace(); if (e