When using
file.createNewFile();
I get the following exception
java.io.IOException: Parent directory of file does not exis
Have you tried this?
file.getParentFile().mkdirs(); file.createNewFile();
I don't know of a single method call that will do this, but it's pretty easy as two statements.