title: IOException at java.io.File.createNewFile();
body: <p>I do have some code for serialization which does not work. I have tried to insert both CanRead() and CanWrite() in if-statements which showed they did not have permissions to read and write. I have also tried to insert 'java.io.File.setReadable' and 'java.io.File.setWriteable to true but it still throws the error.</p>
  
  <p>The code is as following:</p>
  
  <pre><code>public static void save(Object obj, String filename) throws FileNotFoundException, IOException
  {
      File f = new File("c:/DatoChecker/" + filename);
      File dir = new File("c:/DatoChecker");
      if(!dir.exists())
          dir.mkdirs();
      f.setReadable(true);
      f.setWritable(true);
      if(!f.exists())
      {
          f.createNewFile();
      }
      FileOutputStream op = null;
      ObjectOutputStream objectStream = null;
      op = new FileOutputStream(f);
      objectStream = new ObjectOutputStream(op);
      objectStream.writeObject(obj);
      objectStream.close();
  }
  
  public static Object fetch(String filename) throws FileNotFoundException, IOException, ClassNotFoundException
  {
      File f = new File("c:/DatoChecker" + filename);
      File dir = new File("c:/DatoChecker");
      if(!dir.exists())
          dir.mkdirs();
      f.setReadable(true);
      f.setWritable(true);
      if(!f.exists())
      {
          f.createNewFile();
      }
      FileInputStream ip = null;
      ObjectInputStream objectStream = null;
      Object obj = null;
      ip = new FileInputStream(f);
      objectStream = new ObjectInputStream(ip);
      obj = objectStream.readObject();
      ip.close();
      objectStream.close();  
      return obj;
  }
  </code></pre>
  
  <p>Stacktrace: </p>
  
  <pre><code>SEVERE: null
  java.io.IOException: access denied
      at java.io.WinNTFileSystem.createFileExclusively(Native Method)
      at java.io.File.createNewFile(File.java:947)
      at com.check.me.Serialization.fetch(Seralization.java:39)
      at com.check.me.GoodsList.load(GoodsList.java:82)
      at com.check.me.START.main(START.java:22)
  </code></pre>
  
  <p>The one for save is congruet from GoodsList (just save instead of load) and up but it is quite a bit longer below so I will leave it out for now.</p>
  
  <p>Thanks for the help beforehand
  <br/>
  Highace2</p>