How can I create an empty folder in Java?
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
The following code would be helpful for the creation of single or multiple directories:
With Java 7 and newer you can use the static Files.createDirectory() method of the
java.nio.file.Files
class along withPaths.get
.The method Files.createDirectories() also creates parent directories if these do not exist.
Using Java 8:
Same:
Or
Same:
Call
File.mkdir
, like this:Use
mkdir()
: