I am attempting to write a file using java.io, where I am trying to create it at the location \"some/path/to/somewhere/then-my-file\"
. When the file is being create
Guava also has Files.createParentDirs(File).
Since the question also mentioned the library Apache Common IO, I report in the following a solution that uses this nice library:
File file = new File("... the directory path ...");
FileUtils.forceMkdir(file);
This solution uses the class FileUtils, from package org.apache.commons.io
and the method forceMkdir, that "Makes a directory, including any necessary but nonexistent parent directories".
new File("some/path/to/somewhere/then-my-file").getParentFile().mkdirs()