Rewrote question with more info
I have some code that creates a Path object using relative paths, like this: Paths.get("..", "folder").resolve("filename"). Later, I want to get the path string "..\folder\filename" from it (I'm on windows, so backslashes). When I run this code using manual compile or from Eclipse, this works fine.
However, when I run it using Maven, it doesn't work any more. The toString() method returns [.., folder, filename] instead of an actual path string. Using path.normalize() doesn't help. Using path.toFile().getPath() does return what I'm looking for, but I feel there should be a solution using just the nio.path API.
Paths.get("path/to/file").toString()andPaths.get("path", "to", "file").toString()both return"path/to/file"for me.Paths.get("path/to").resolve("file").toString(), which returns"path/to/file".Paths.get("path", "to", "file").getClass().getName()? Perhaps you're picking up a wonky FileSystem implementation.Paths.get("..", "path/to", "file"). I didn't think it would be relevant to the question, but apparently it is.