Java Files create symbolic link

Description

Java Files create symbolic link

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) {
    Path existingFilePath = Paths.get("Main.java");
    Path symLinkPath = Paths.get("test1_link.txt");
    try {/*w ww.  ja  va2  s  . co m*/
      Files.createSymbolicLink(symLinkPath, existingFilePath);
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
}



PreviousNext

Related