This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes classpath Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "classpath" Watch "classpath" New topic
Author

classpath

Chintu Singh
Greenhorn

Joined: May 08, 2013
Posts: 20
The classpath is disturbing me a lot
Can anybody help on the following text form K&B book.
Let's use the same directory structure and a different classpath:

Directory Structure



Command is :



In this case, what directories will be searched if the current directory is dirA?
How about if the current directory is root? How about if the current directory is
dirB? In this case, both paths in the classpath are absolute. It doesn't matter what
the current directory is; since absolute paths are specified the search results will
always be the same. Specifically, only dirC will be searched, regardless of the current
directory. The first path (/dirB) is invalid since dirB is not a direct subdirectory of
root, so dirB will never be searched. And, one more time, for emphasis, since dot (.)
is not in the classpath, the current directory will only be searched if it happens to be
described elsewhere in the classpath (in this case, dirC).

Please help.


OCPJP
K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 2243
    
    7

Chintu Ji wrote:In this case, what directories will be searched if the current directory is dirA?
How about if the current directory is root? How about if the current directory is
dirB? In this case, both paths in the classpath are absolute. It doesn't matter what
the current directory is; since absolute paths are specified the search results will
always be the same. Specifically, only dirC will be searched, regardless of the current
directory. The first path (/dirB) is invalid since dirB is not a direct subdirectory of
root, so dirB will never be searched. And, one more time, for emphasis, since dot (.)
is not in the classpath, the current directory will only be searched if it happens to be
described elsewhere in the classpath (in this case, dirC).


Well what you described is correct. So how is it disturbing?


K. Tsang JavaRanch SCJP5 SCJD/OCM-JD OCPJP7 OCPWCD5
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: classpath
 
Similar Threads
K and B Chapter 10 pg no 802
classpath - chapter 10 - K&B
classpath
classpath.
Relative and Absolute Paths