Here you can find the source of makeDirectory(File dir)
Parameter | Description |
---|---|
dir | a parameter |
Parameter | Description |
---|---|
IOException | an exception |
public static void makeDirectory(File dir) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.File; import java.io.IOException; public class Main { /**/*from ww w. ja v a 2s.com*/ * * @param dir * @throws IOException */ public static void makeDirectory(File dir) throws IOException { if (dir.exists()) { if (!dir.isDirectory()) { throw new IOException("File '" + dir + "' is already exist"); } } else { if (!dir.mkdirs()) { throw new IOException("Cannot create directory '" + dir + "'"); } } } }