Here you can find the source of getTempDir()
public static File getTempDir()
//package com.java2s; /******************************************************************************* * Copyright (c) 2005-2012 eBay Inc.// www.j a v a 2s .c o m * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * *******************************************************************************/ import java.io.File; public class Main { /** * @return readable temporary directory (do not delete) */ public static File getTempDir() { String tmpDirPath = "/tmp/";// System.getProperty("java.io.tmpdir"); if (null != tmpDirPath) { File result = new File(tmpDirPath); result.mkdirs(); if (readableDirectory(result)) { return result; } } return null; } public static boolean readableDirectory(File dir) { return (null != dir) && dir.canRead() && dir.isDirectory(); } }