Differences of File.getCanonicalPath() and File.getAbsolutePath()
Author
Zhou Renjian
Create@
2004-12-06 13:56
When the file is under a linked folder or is a linked file in Linux, new File(path).getCanonicalPath() will get the physical path of the file, while new File(path).getAbsolutePath() will just get the absolute path of the file in which will include the linked folder or just linked file.
For example:
I have a folder "wform" linking to /home/zhourj/bin/jakarta-tomcat-5.0.28/webapps/webform, then
new File("/home/zhourj/wform").getCanonicalPath() --> /home/zhourj/bin/jakarta-tomcat-5.0.28/webapps/webform
new File("/home/zhourj/wform").getAbsolutePath() --> /home/zhourj/wform