File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Files :  Path,Canonical Path,Absolute path ? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Mongo DB Applied Patterns this week in the MongoDB forum
or a resume review from Five Year Itch in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Files :  Path,Canonical Path,Absolute path ?" Watch "Files :  Path,Canonical Path,Absolute path ?" New topic
Author

Files : Path,Canonical Path,Absolute path ?

Jennifer Wallace
Ranch Hand

Joined: Nov 30, 2001
Posts: 102
I am not clear in my understanding of this whole issue of "path".
What I know is that path of a file means the location of a file in a computer system.
But what is the path name which we give in the File constructor ?
what is canonical path and absolute path ?
Could somebody explain this in very simple terms or examples ?
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
Try this:
http://www.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=33&t=001420


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

Joined: Nov 30, 2001
Posts: 102
Thanks. I am able to grasp the difference between Canonical and Absolute paths.
But one another doubt,
"test.txt" exists in my current working directory and if I try to print the parent directory of the file, I get null. What am I missing here ?
File f=new File("test.txt");
System.out.println(f.getParent{});
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1506
You have to specify the entire path when you create the file object.File f=new File(path to file\"test.txt");


Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
 
I agree. Here's the link: http://jrebel.com/download
 
subject: Files : Path,Canonical Path,Absolute path ?
 
Similar Threads
absolute/relative/canonical....
canonical path and absoulte path
Diff betw canonical and absolute
canonical path...
Canonical vs Absolute