title: Creating a Temp Dir in Java
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/617414/create-a-temporary-directory-in-java">Create a temporary directory in Java</a>  </p>
  </blockquote>
  
  
  
  <p>I have a test for a create DB method and I need a temp directory to put it in. The directory will be removed after the test is done. I tried using <code>File.createTempFile()</code>, like so:</p>
  
  <pre><code>tempDir = File.createTempFile("install", "dir");
  tempDir.mkdir();
  </code></pre>
  
  <p>But <code>tempDir</code> is already exists as a file. How do I create a temp directory as opposed to a file?</p>