Java tutorial
//package com.java2s; //License from project: LGPL import java.io.File; import java.io.IOException; public class Main { public static boolean createFile(String filename) { final File file = new File(filename); final File pf = file.getParentFile(); if (!pf.exists()) { pf.mkdirs(); } if (!file.exists()) { try { file.createNewFile(); } catch (IOException e) { e.printStackTrace(); return false; } } return true; } }