This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes what are the differences in this . Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "what are the differences in this ." Watch "what are the differences in this ." New topic
Author

what are the differences in this .

vishwas bhatt
Ranch Hand

Joined: Nov 30, 2000
Posts: 129
AbsolutePath | CanonicalPath

Please Explain By Example If possible.

wating for repaly from my all javaGuru's.
Sean MacLean
author
Ranch Hand

Joined: Nov 07, 2000
Posts: 621
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
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
Canonical means "according to the law".


"JavaRanch, where the deer and the Certified play" - David O'Meara
vishwas bhatt
Ranch Hand

Joined: Nov 30, 2000
Posts: 129
hi cindy and sean .

ok iget what it is .. but can you give me example of canonical path.
thanx alot.
wating for reply.
deekasha gunwant
Ranch Hand

Joined: May 06, 2000
Posts: 396
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


 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: what are the differences in this .