Given a File
or Path
directory object, how do I check if it is a symlink and how do I resolve it to the actual directory?
I've tried File.getCannonicalFile()
, Files.isSymbolicLink(Path)
and many other methods, but none of them seem to work. One interesting thing is that Files.isDirectory(Path)
returns false, while Files.exists(Path)
is true. Is java treating the symlink as a file instead of a directory?
Files.isSymbolicLink
not working? What operating system are you on? Works fine for me on Linux, anyway. – Shame