How do I create Directory/folder?
Once I have tested System.getProperty("user.home");
I have to create a directory (directory name "new folder" ) if and only if new folder does not exist.
How do I create Directory/folder?
Once I have tested System.getProperty("user.home");
I have to create a directory (directory name "new folder" ) if and only if new folder does not exist.
The following method should do what you want, just make sure you are checking the return value of mkdir() / mkdirs()
With Java 7, you can use
Files.createDirectories()
.For instance:
Neat and clean:
mkdir vs mkdirs
If you want to create a single directory use
mkdir
If you want to create a hierarchy of folder structure use
mkdirs
This function allows you to create a directory on the user home directory.