Java examples for File Path IO:Symbolic Link
CreateLink method creates a hard link to an existing file
import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; public class Main { public static void main(String[] args) throws Exception { try {//from w w w .j a v a 2 s .co m Path targetFile = Paths.get("C:/home/docs/users.txt"); Path linkFile = Paths.get("C:/home/music/users.txt"); Files.createLink(linkFile, targetFile); } catch (IOException ex) { ex.printStackTrace(); } } }