HOME      BLOG       FORUMS      CONTACT       ABOUT

Create a temp file using java

Create a temp file using java

The createTempFile method of File class helps us to create a temporary file.

import java.io.File;
import java.io.IOException;
/**
 * File class examples.
 *
 */
public class FileExample  {
	public static void main(String[] args) throws IOException{
		// Create file object representing the source file/directory
		File file = new File("d:\\temp");

		// Create the temporary file.
		File tempFile = File.createTempFile("test", ".tmp",file);
	}
}

Share

Tags: , , , ,


You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

AddThis Social Bookmark Button

Leave a Reply