Here you can find the source of createTempDir()
public static File createTempDir() throws IllegalStateException
//package com.java2s; /*/*from w ww . j a va 2 s.c o m*/ * Copyright 2012 Red Hat, Inc. and/or its affiliates. * * Licensed under the Eclipse Public License version 1.0, available at * http://www.eclipse.org/legal/epl-v10.html */ import java.io.File; import java.io.IOException; import java.nio.file.Files; public class Main { /** * Create a temporary directory. */ public static File createTempDir() throws IllegalStateException { File baseDir = getTempDirectory(); try { return Files.createTempDirectory(baseDir.toPath(), "tmpdir") .toFile(); } catch (IOException e) { throw new IllegalStateException( "Error while creating temporary directory", e); } } /** * Get the current system temp directory. */ public static File getTempDirectory() { return new File(System.getProperty("java.io.tmpdir")); } }