title: Unable to delete file using file.delete()
body: <p>I'm unable to delete my file, i have looked here but can't find the answer.
  i have rights to delete,files,the files exist.Below is a class which contains a method delete file</p>
  
  <pre><code>public boolean deleteFile(String filePath)
      {
  
              File fileToDelete = new File(filePath);
              System.out.println("In delete file(): "+fileToDelete.exists());
              boolean deleted = fileToDelete.delete();
              return deleted;
  
      }
  </code></pre>
  
  <p>and i have a button that have a action listener to delete a file based on a CONSTANT string file path.</p>
  
  <pre><code>STFile file = new STFile();
  System.out.println("Deleting from"+STMain.TITLES_PATH+""+file.deleteFile(STMain.TITLES_PATH));
  
  
  public static final String TITLES_PATH = System.getProperty("user.dir")+"\\titlesPath.txt";
      public static final String IMAGES_PATH = System.getProperty("user.dir")+"\\imagesPath.txt";
      public static final String SOUNDS_PATH = System.getProperty("user.dir")+"\\soundPath.txt";
  </code></pre>
  
  <p>the files exists and the directory exists, may i know what is preventing me from deleting them?
  is it because i have a fileoutputstream?but i have them closed,btw the qnsTitle,qnsImagePath,qnsSoundPath are all arraylists containing strings.</p>
  
  <pre><code>public void writeFiles()
      {
          FileOutputStream f_out = null;
          ObjectOutputStream obj_out = null;
          try {
              f_out = new FileOutputStream(STMain.TITLES_PATH);
              obj_out = new ObjectOutputStream (f_out);
              obj_out.writeObject(qnsTitle);
              f_out.close();
              f_out = new FileOutputStream(STMain.IMAGES_PATH);
              obj_out = new ObjectOutputStream (f_out);
              obj_out.writeObject(qnsImagePath);
              f_out.close();
              f_out = new FileOutputStream(STMain.SOUNDS_PATH);
              obj_out = new ObjectOutputStream (f_out);
              obj_out.writeObject(qnsSoundPath);
              f_out.close();
          } catch (IOException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
      }
  </code></pre>