Here you can find the source of createDirIfNotExists(String d)
public static void createDirIfNotExists(String d)
//package com.java2s; import java.io.File; public class Main { public static void createDirIfNotExists(String d) { createDirIfNotExists(new File(d)); }//from w ww. j av a2s.c om public static void createDirIfNotExists(File d) { if (d.exists()) { verifyIsDir(d); return; } boolean created = d.mkdirs(); if (!created) throw new IllegalStateException("Could not create directory " + d); } private static void verifyIsDir(File f) { if (!f.isDirectory()) throw new RuntimeException(f.getPath() + " is not directory"); } }