Well, I know this has been inactive for a while, but I thought there might have been a simple solution. The article you pointed out in the comments on the question seems to indicate that the only problem is that directories are not created. The solution was to do this:
if (!f.mkdirs()) { f.mkdirs(); }
However, this seems inefficient and may still have problems. So why not just do this:
while (!f.mkdirs()) {}
Simple but it works.
EDIT: After a little thought, this example may freeze and may cause thread blocking. So this might be a better idea:
while (!f.mkdirs()) { Thread.yield(); }
Of course, this would be recommended only if you are in a thread that could cause thread blocking, and so far this is not a priority situation. Just put it there.
Alexis king
source share