Java tutorial
import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.attribute.BasicFileAttributes; public class Test { public static void main(String[] args) throws Exception { Path file = Paths.get("/opt/platform/java"); if (Files.isSymbolicLink(file)) { file = Files.readSymbolicLink(file); } Files.readAttributes(file, BasicFileAttributes.class); } }