Java tutorial
import java.io.IOException; import java.nio.file.FileSystems; import java.nio.file.Files; import java.nio.file.Path; public class Main { public static void main(String[] args) { Path basedir = FileSystems.getDefault().getPath("C:/tutorial/tmp/"); String tmp_dir_prefix = "Swing_"; //get the default temporary folders path String default_tmp = System.getProperty("java.io.tmpdir"); System.out.println(default_tmp); try { //set a prefix Path tmp_2 = Files.createTempDirectory(tmp_dir_prefix); System.out.println("TMP: " + tmp_2.toString()); } catch (IOException e) { System.err.println(e); } } }