Here you can find the source of getTempDirectoryStr()
public static synchronized String getTempDirectoryStr()
//package com.java2s; /*//from ww w .j a v a 2 s . c om * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ import java.io.File; public class Main { /** property indicating the temp directory to use. */ public final static String PROPERTY_TMPDIR = "adams.io.tmpdir"; /** the temporary directory. */ protected static String m_TempDir; /** * Returns the temporary directory as string. * * @return the temp directory */ public static synchronized String getTempDirectoryStr() { String dir; File file; if (m_TempDir == null) { dir = System.getProperty(PROPERTY_TMPDIR); if (dir == null) { dir = System.getProperty("java.io.tmpdir"); } else { file = new File(dir); if (!file.exists()) { if (!file.mkdirs()) { dir = System.getProperty("java.io.tmpdir"); System.err.println("Failed to create temp directory '" + file + "', reverting back to system's default: " + dir); } } } try { m_TempDir = new File(dir).getCanonicalPath(); } catch (Exception e) { m_TempDir = dir; } } return m_TempDir; } }