title: Create whole path automatically when writing to a new file
body: <p>I want to write a new file with the <a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/io/FileWriter.html" rel="noreferrer"><code>FileWriter</code></a>. I use it like this:</p>
  
  <pre><code>FileWriter newJsp = new FileWriter("C:\\user\Desktop\dir1\dir2\filename.txt");
  </code></pre>
  
  <p>Now <code>dir1</code> and <code>dir2</code> currently don't exist. I want Java to create them automatically if they aren't already there. Actually Java should set up the whole file path if not already existing.</p>
  
  <p>How can I achieve this?</p>