Here you can find the source of createTempDir(String subdirectory)
public static Path createTempDir(String subdirectory) throws IOException
//package com.java2s; //License from project: Apache License import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; public class Main { public static Path createTempDir(String subdirectory) throws IOException { String systemTmpDir = System.getProperty("java.io.tmpdir"); Path tempDirPath = Paths.get(systemTmpDir, subdirectory); if (Files.notExists(tempDirPath)) { return Files.createDirectory(tempDirPath); } else {// ww w. ja v a 2 s. c o m return tempDirPath; } } }