An absolute path is just that - an path that represents a undisputable path to a file or a directory. For example, path = c:\dir1\dir2\file Now a canonical path is similar, yet stangely different. Consider this mathimatical definition of canonical,
"Two formulas such as 9 + x and x + 9 are said to be equivalent because they mean the same thing, but the second one is in `canonical form' because it is written in the usual way, with the highest power of x first." To apply this to paths, if you have two 'paths' to the same file but one is an alias, then the other one (assuming it is an 'absolute' path) is the canonical path. The confusion stems from the fact that the use of canonical in this instance is not directly related to the true definition of the word. Sean
Joined: Sep 29, 2000
Canonical means "according to the law".
"JavaRanch, where the deer and the Certified play" - David O'Meara
Joined: Nov 30, 2000
hi cindy and sean .
ok iget what it is .. but can you give me example of canonical path. thanx alot. wating for reply.
Joined: May 06, 2000
Hi Vishwas, first of all i'd request u to make the following structure in your c:\ c:\A\B\C\MyFile Now run the following code and you will understand it yourself.
just in case you don't want to run it. getAbsolutePath : will return u the same String with which u created the File Object. getCanonicalPath : will return the minimum length path that represents that file or directory.
run it and the meaning of these two lines will be clear to u. regards Deekasha