Java Files check if a path is symbolic link

Description

Java Files check if a path is symbolic link

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 path1 = null;/*from   w w w  .java 2 s  . co  m*/
      Path path2 = null;

      path1 = Paths.get("/home/java/users.txt");
      path2 = Paths.get("/home/css/users.txt");

      System.out.println(Files.isSymbolicLink(path1));
      System.out.println(Files.isSymbolicLink(path2));
   }
}



PreviousNext

Related