File Object Issue with Windows (Absolute Path Appending project directory)
Posted on 2006-05-26
I have a program that is using File objects that worked just fine when I was running it on Linux, but I use it on Windows and I am having a problem.
I am pulling my path string from my database and then constructing a File object. This all works fine in Linux. But, when I try to run it on Windows, it is appending what appears to be the directory that I am running the program from, to the front of my path. So, from looking over the javadocs, my best guess is that it is interpreting my path as being a _relative_ path rather than an absolute path. But, this is what I am sending from the DB: E:\dir1\dir2\subdir3. I've tried adding extra \ so that it is more or less E:\\dir1\dir2\subdir3 with no luck. (Again, JavaDocs seemed to indicate that the double \ would tell Java this is an absolute path.)
If I run tests for isDir or isFile, it returns false. It also returns false for isAbs, which would be obvious since, again, it is feeling the need to append my string to the current path.
The question is: How do I get Java to realize this is an absolute path? I've been pulling my hair out for some time on this now.
I doubt that it matters, but I'm using NetBeans for a GUI for this.