Duplicate: stackoverflow.com/questions/375910
Is there a way of creating a temporary folder in java ? I know of File's static method createTempFile, but this will only give me a temporary file.
Duplicate: stackoverflow.com/questions/375910
Is there a way of creating a temporary folder in java ? I know of File's static method createTempFile, but this will only give me a temporary file.
I've never seen a good solution for this, but this is how I've done it.
File temp = File.createTempFile(...);
temp.delete();
temp.mkdir();
I write my own utility classes for creating temporary directories and for disposing them when they are not anymore needed. For example like this.
Any reason you can't use the directory defined by the java.io.tmpdir property?
ie
String dirName = System.getProperty("java.io.tmpdir");
I would check out this past question in SO for a solution. Or this one!