Getting canonical path from Path in Java

java

Solution

See normalize and toRealPath.

Problem

I have a `Path` object, but it appears it does not have a `getCanonicalPath()` method like in the `File` class. Reason is I have dots in the Path that I want to eliminate to get something "unique": ``` /some/path/./something # should be /some/path/something ```

Original source