Can anyone explain me whats getCanonicalPath() and getAbsolutePath(). i read that getAbsolutePath() returns the absolute path including the parent directories and as well including the file name itself from where u onvoke this method. for eg: C:\java\javastudy\file1.txt is this correct?
how does getAbsolutePath() work? please explain......
Consider that you have a file myfile.txt in c:\paul\java\temp Now, File f = new File("c:\paul\java\..\java\temp\myfile.txt"); f.absolutePath() is c:\paul\java\..\java\temp\myfile.txt and f.canonicalPath() is c:\paul\java\temp\myfile.txt, you can see that there is no "redundancy" in canonical path. HTH, Paul. ------------------ Get Certified, Guaranteed! (Now Revised for the new Pattern) www.enthuware.com/jqplus
[This message has been edited by Paul Anil (edited February 13, 2001).]
Paul i still didn't completely understand canonicalpath. Redudancy in sense without any \.. or \. etc..? what happens to the other java folder, c:\paul\java\..\java\temp\myfile.txt there are 2 java folders right?
There is only one java dir. java/../java implies, you go to java then go back one dir and again go to java. ( .. => parent dir, . => current dir ) HTH, Paul. ------------------ Get Certified, Guaranteed! (Now Revised for the new Pattern) www.enthuware.com/jqplus