You can use this method to get temp file location according to your Operating System
public static String getSystemFileLocation()
{
File tmpFile = null;
String fileLocation="/tmp/";
if (System.getProperty("os.name").toUpperCase().indexOf("WINDOWS") == 0) {
tmpFile=new File("c:\\temp");
if(tmpFile.exists()) {
fileLocation="c:\\temp\\";
}
else {
tmpFile.mkdir();
fileLocation="c:\\temp\\";
}
}
else if (System.getProperty("os.name").toUpperCase().indexOf("WINDOWS") == -1) {
fileLocation="/tmp/";
}
return fileLocation;
}