Creating a Directory By using the default FileSystem - Java File Path IO

Java examples for File Path IO:Directory Create

Description

Creating a Directory By using the default FileSystem

Demo Code

import java.io.IOException;
import java.nio.file.FileSystem;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;

public class Main {

  public static void main(String[] args) {
    FileSystem fileSystem = FileSystems.getDefault();
    Path directory = fileSystem.getPath("./newDirectoryWPermissions");
    try {//from  w w w. j av a  2 s  .  c om
      Files.createDirectory(directory);

    } catch (IOException e) {
      e.printStackTrace();
    }
  }

}

Related Tutorials