title: java file.delete() won't work
body: <p>I have created a properties file and I want to encrypt that keep the same folder encrypted properties file and delete the original properties file. When I do this on my java application first time it does correct way. But when I do this again it doesn't delete the created original properties file. When I try to delete that manually it gives me a try again message saying that "The action can't be completed because the file is open in java(TM) platform SE binary.Close the file and try again." After I closing my application it can be deleted manually. My code is as follows. Problem is on the propfile123.delete(). How can I resolve this problem.</p>
  
  <pre><code>//Encrypt the property file
          Encrypt_Decrypt encrpt= new Encrypt_Decrypt("AES/ECB/PKCS5Padding","properties\\"+name_of_propertice_file+".properties", mstr_pass);
          try {
              encrpt.encrypt();
          } catch (Exception ex) {
              Logger.getLogger(Secure_File.class.getName()).log(Level.SEVERE, null, ex);
          }
  
          //delete the original properties file
          File propfile123= new File("properties\\"+name_of_propertice_file+".properties");
          System.out.println(propfile123.exists());   // always return true
  
          System.out.println(propfile123.delete());   //here returns false when I call at second time to this method.
  </code></pre>