Here you can find the source of mkdir(File dir)
Parameter | Description |
---|---|
dir | the directory to be created. |
Parameter | Description |
---|---|
IOException | if the file could not be created. |
public static void mkdir(File dir) throws IOException
//package com.java2s; import java.io.File; import java.io.IOException; public class Main { /**/*from ww w.java 2 s . co m*/ * Creates the given directory. * * @param dir the directory to be created. * @throws IOException if the file could not be created. * @see File#mkdir() */ public static void mkdir(File dir) throws IOException { if (!dir.exists() || !dir.isDirectory()) { if (!dir.mkdir()) { throw new IOException("Failed to create directory " + dir); } } } }