Java examples for File Path IO:Symbolic Link
Checking If a Link and a Target Point to the Same File
import java.io.IOException; import java.nio.file.FileSystems; import java.nio.file.Files; import java.nio.file.Path; public class Main { public static void main(String[] args) { Path link = FileSystems.getDefault().getPath("my"); Path target = FileSystems.getDefault().getPath("C:/folder1/photos", "test.jpg"); try {//from w w w . j av a 2 s . c o m Files.createSymbolicLink(link, target); Path linkedpath = Files.readSymbolicLink(link); System.out.println(linkedpath.toString()); } catch (IOException e) { System.err.println(e); } } }