![]() While the Path object is immutable, it returns a new instance. Path canonicalPath = path.toRealPath().normalize() Path absolutePath = path.toAbsolutePath() ![]() ![]() String canonicalPathStr = file.getCanonicalPath() String absolutePathStr = file.getAbsolutePath() To get absolute or canonical paths, we can use: // java.io API Be aware that, unlike the previous examples, most of them are performed directly on object instances. In the end, let's quickly look at methods in the File class for getting the filesystem path.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |