title: File.createNewFile() thowing IOException No such file or directory
body: <p>I have a method that writes to a log file. If the file exists it should append to it, if not then I want it to create a new file.</p>
  
  <pre><code>if (!file.exists() &amp;&amp; !file.createNewFile()) {
      System.err.println("Error with output file: " + outFile
          + "\nCannot create new file.");
      continue;
  }
  </code></pre>
  
  <p>I have that to check that a file can be created. file is a java.io.File object. createNewFile is throwing an IOException: No such file or directory. This method has been working perfectly since I wrote it a few weeks ago and has only recently starting doing this although I don't know what I could have changed. I have checked, the directory exists and I have write permissions for it, but then I thought it should just return false if it can't make the file for any reason.</p>
  
  <p>Is there anything that I am missing to get this working?</p>