I think using something like commons-io's FileUtil class to build a File is a bit more idiomatic.