Java tutorial
//package com.java2s; import java.io.File; import java.io.IOException; import java.io.RandomAccessFile; public class Main { public static boolean createEmptyFile(String path, long size) throws IOException { File file = new File(path); File parent = file.getParentFile(); parent.mkdirs(); RandomAccessFile raf = new RandomAccessFile(file, "rw"); raf.setLength(size); raf.close(); return true; } }