Java examples for File Path IO:Temporary File
Create temporary file
import java.io.*; public class Main { public static void main(String[] args) { File file1 = null;/* w ww . java 2 s . c o m*/ File file2 = null; try { file1 = File.createTempFile("JavaTemp", null); file2 = File.createTempFile("JavaTemp", ".javatemp"); } catch(IOException ioe) { System.out.println("Exception creating temporary file : " + ioe); } System.out.println("Temporary file without suffix extension: " + file1.getPath()); System.out.println("Temporary file with suffix extension: " + file2.getPath()); } }