You may want to use Apache Commons IO
's FileUtils.openOutputStream(File) method. It has good Exception messages when something went wrong and also creates necessary parent dirs. If everything was right then you directly get your OutputStream - very neat.
If you just want to touch
the file then use FileUtils.touch(File)
instead.