Here you can find the source of getTempDir()
public static String getTempDir()
//package com.java2s; //License from project: Apache License import java.io.*; public class Main { /**/*from www . j a v a 2 s. com*/ * get temp dir from OS. * * @return String temp dir */ public static String getTempDir() { // default is user home directory String tempDir = System.getProperty("user.home"); try { //create a temp file File temp = File.createTempFile("A0393939", ".tmp"); //Get tempropary file path String absolutePath = temp.getAbsolutePath(); tempDir = absolutePath.substring(0, absolutePath.lastIndexOf(File.separator)); } catch (IOException e) { } return tempDir; } }