...
Use the getCanonicalPath()
method, introduced in Java 2, wherever possible since it resolves the aliases, shortcuts or symbolic links across all platforms. The value of the alias is not included in the returned value. Moreover, relative references like the double period (..) are also removed. The getCanonicalPath()
method throws a security exception when used within applets since it reveals too much information about the host machine. The getCanonicalFile()
method (Java 2) behaves like getCanonicalPath()
but returns a new File
object instead of a String
.
...