Can you use `java.io.File.createTempFile("temp", "")` here? Here's the [javadoc](http://docs.oracle.com/javase/6/docs/api/java/io/File.html#createTempFile%28java.lang.String,%20java.lang.String,%20java.io.File%29). Don't forget to call `tmpFile.deleteOnExit()`.