|
Java™ by example!
|
|
|
What is the difference between getAbsolutePath and getCanonicalPath?
getCanonicalPath() resolves relative paths. It also restores original capitalization. You can use canonical paths to determine if two paths are the same, eg. c:\windows\..\autoexec.bat and c:\autoexec.bat will be equal if you get the path using getCanonicalPath but different with getAbsolutePath. Main.java:
outputs:
Further Information
Author of answer: Joris Van den Bogaert
Comments to this answer are only viewable by members. Login or become a member!
|
|
|
|
|