Here you can find the source of createDirIfNotExists(File d)
public static void createDirIfNotExists(File d)
//package com.java2s; import java.io.File; public class Main { public static void createDirIfNotExists(String d) { createDirIfNotExists(new File(d)); }/*www . j a va 2s . 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"); } }