Re: referring to file in a relative way



Hal Rosser wrote:
If you're in the org directory then
File theFile = new File("../../data/info.txt");
Then you can use methods of the File class to get the absolute path, etc if
you need it.
Each dot-dot-slash takes you to the parent directory of wherever you happen
to be,

Which if it's close to the root will cause a problem.

Use of parent-directory relative references is not very safe. One
should ensure that all program resources are in a subdirectory of the
working directory so that "dot-dot-slash" is never used.

--
Lew




.