Java File create directory tree, create parent directories if it does not exist
import java.io.File; public class Main { public static void main(String[] args) { File newDir = new File("C:/demo/demo2s.com/home"); boolean created = newDir.mkdirs(); System.out.println(created);//from w w w. java 2 s . c om } }