I am trying to load a directory from a properties file. I have the following defined in the property file:
image.src.dir = "C:\\Temp\\foo\\"
Yes, the directory name is like that … with mixed case. I have also tried simply referring to the directory as "/Temp/foo" with the same outcome.
I have the following code which fails despite the directory existing.
String srcDir = prop.getProperty("image.src.dir");
File folder = new File(srcDir);
if (!folder.isDirectory()) {
System.err.println("Directory: " + srcDir + " doesn't exist");
}
Thanks for the hint …
The problem & solution:
solution: image.src.dir=C:\\Temp\\foo\\
problem: image.src.dir = "C:\\Temp\\foo\\"
That was my problem ..!
Did you try to System.println(srcDir) if the string gets properly loaded from the properties file? Is the directory accessible (are the rights for superdirectories correct?).