Dumpcats
Dumpcats

Reputation: 453

Relative pathing syntax involving dot-dot-slash

I saw this statement while looking up relative pathing for ant and was quite bewildered:

<pathelement location="../../../../../../programs/jdk1.5.0/lib/tools.jar"/>

I know that .. refers to going up one directory, so my guess is that the ../../../../../../ portion is referencing up six directories, but I'm at a loss for what purpose it serves.

Upvotes: 0

Views: 379

Answers (1)

Ian W
Ian W

Reputation: 4767

There are some instances where using an absolute path simply does not work. We have two build server clusters; the old is set up according to one convention where the base directory for all workspaces is:

/work/storage/project/build/myid/workspace

The new cluster is set up with workspaces in:

/builds/myid/workspace

If there's a "common directory", in our case:

.../builds/tools/
.../build/tools/

It is a convenient way to access "tools", knowing it is "up 6, then down the other leg, without knowing the true location.

Of course, I agree with user2864740 that in your example the reference is to a "known" location, which should be accessed via java.home; otherwise, changing your java version can have unpredictable results or involve a lot of search/replace.

Upvotes: 1

Related Questions