Oops! I was in a hurry when I wrote that, and put the wrong constant in there! Thanks for catching that, David, and my apologies to any readers I may have confused...
Give a man a fish, he'll eat for one day. Teach a man to fish, he'll drink all your beer.
Cheers, Jeff (SCJP 1.4 all those years ago...)
Now I wonder, how to append to this user dir the filename in such a way that it will work on systems other than Windows too ?
Idea's ???
I believe if you just leave the path off, most, if not all operating systems that Java runs on will use the current working directory. At least both Unix and Windows will do this.
Windows (and DOS) has the additional property that each drive has a current directory. But if you don't specify anything it uses the drive the program was started in.
Originally posted by David Abramowicz: Actually, path separator is what is used to separate COMPLETE paths, ';' in Windows and ':' in Unix.
What you are looking for is File.separator which is '\' in Windows and '/' in Unix.
Not exactly inuitive is it
/Dave
And why should one mess with the separator, when Java can handle this trouble for us? Just use Or (I would guess this is essentially the same; look it up if you want to be sure):
hi, i think if we code like this: File file = new File("suncertify.properties"); that is to say we want to find suncertify.properties in current working directory.