Here you can find the source of createFileInFolder(File folder, String fileName)
public static File createFileInFolder(File folder, String fileName) throws IOException
//package com.java2s; import java.io.File; import java.io.IOException; public class Main { public static File createFileInFolder(File folder, String fileName) throws IOException { File file = removeableFile(folder, fileName); file.createNewFile();/*from ww w . ja v a 2 s .c o m*/ return file; } private static File removeableFile(File folder, String fileName) { File file = new File(folder, fileName); file.deleteOnExit(); return file; } }