mkdir « Development « Java I/O Q&A

1. File.mkdir is not working and I can't understand why

I've this brief snippet:

String target = baseFolder.toString() + entryName;
                target = target.substring(0, target.length() - 1);

2. How to get a meaningful message for failed calls to Java File objects (mkdir, rename, delete)

While using File.mkdir, and friends I notice that they don't throw exceptions on failure! Thankfully FindBugs pointed this out and now my code at least checks the return value ...

4. File.mkdir() broken ?

5. File's mkdir() method does not throw an exception?

As Jesper said, this is a design question that really has no right or wrong answer. But I suspect that the reason for the Java API designers' choice was that they didn't want to introduce a checked exception for a method call where a "failure" often doesn't really indicate an exceptional circumstance. It's very common to write code where you want ...

6. file.mkdir() failes

7. File.mkdir()

Hi all, First off all I'm new to the forum and I'm not sure where to post my question... I'm trying to create a fileCopier class and everything works ok but I still want one thing to make it absolutly bug-free. Suppose I want to copy c:\Test to c:\bla My program copies all files and subdirectories unless there is a FILE ...

8. Trouble with File().mkdir()

9. creating nested directories with File.mkdir()

Well, just assigning a value to a String isn't magically going to create a directory as a side effect. But probably you knew that and just omitted some of the code you meant to ask about. Did you not see the "mkdirs" method? It's right next to "mkdir" in the API documentation.