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 Confused with paths Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Confused with paths" Watch "Confused with paths" New topic
Author

Confused with paths

Amit Batra
Ranch Hand

Joined: Mar 04, 2006
Posts: 361
Can someone please explain me the diff between absolute paths and relative paths, Im cant seem to be able to figure the exact difference between the two.
Rohit Nath
Ranch Hand

Joined: Jun 16, 2006
Posts: 387
Not sure if this is the right forum for this question. Anywaz...
Here we go...

Absolute path: giving path starting from the root directory.
Example your root directory say is c: (C drive)
If you have a file myFile.txt in a folder myFolder which is inside another folder myFolder1 present at c:

The to access that file you can give the path
c:\myFolder1\myFolder\myFile.txt

Here you are giving entire path from "root directory". This is called absolute path.

Relative Path:
If you are already in some folder myFolder1 which is a part of the path in which your file is present then you need not start from root directory. Instead you can simply use \myFolder\myFile.txt
This is "realtive" to the CURRENT directory.
Relative means with respect to current active directory.

Hope it helps..


R.N
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
Let's try Java In General (Beginner)


Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
 
 
subject: Confused with paths
 
Similar Threads
Absolute and Relative Path
Confused with paths
relative/absolute paths
Tomcat Installation on NT
applet reading files