Java Files create temporary file
import java.nio.file.Files; import java.nio.file.Path; public class Main { public static void main(String[] args) { try {/*w ww . j a v a2 s.c om*/ Path tFile1 = Files.createTempFile("test", ".txt"); System.out.println("Temp file1: " + tFile1); } catch (Exception e) { e.printStackTrace(); } } }