Determining the target of a link file - Java File Path IO

Java examples for File Path IO:Symbolic Link

Description

Determining the target of a link file

Demo Code

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 {//ww w  . j a  va  2  s.  c o m
      Path linkFile = Paths.get("C:/home/music/users.txt");
      System.out.println("Target file is: " + Files.readSymbolicLink(linkFile));
    } catch (IOException ex) {
      ex.printStackTrace();
    }
  }

}

Related Tutorials