CreateSymbolicLink method creates a symbolic link to a target file that may not exist - Java File Path IO

Java examples for File Path IO:Symbolic Link

Description

CreateSymbolicLink method creates a symbolic link to a target file that may not exist

Demo Code

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 {
    Path targetFile = Paths.get("C:/home/docs/users.txt");
    Path linkFile = Paths.get("C:/home/music/users.txt");
    Files.createSymbolicLink(linkFile, targetFile);
  }//from w  w w  . jav  a 2s.  c om

}

Related Tutorials