title: Can not delete file in java beause it's opened in Java Platform SE binary
body: <p>I have three directories A, B &amp; C on windows. I have a file that exists in directory A.  I want to do the following tasks</p>
  
  <ol>
  <li>Copy it to directory B</li>
  <li>Delete it from directory A (This WORKED since the file was not being held by any process)</li>
  <li>Copy it to directory C </li>
  <li>Delete it from directory B (NOT Work)</li>
  </ol>
  
  <p>Steps 1,2,3 work fine but it does not work with step 4.  The file exists and can write, read, execute.  When I open windows explorer and try to delete the file in directory B manually, it said the action can't be completed because it's opened in java platform SE binary.  Below is my code for copying the file</p>
  
  <pre><code>        FileInputStream in = new FileInputStream(source);
          FileOutputStream out = new FileOutputStream(dest);
  
          byte[] buf = new byte[1024];
          int len;
  
          while ((len = in.read(buf)) &gt; 0) {
              out.write(buf, 0, len);
          }
  
          in.close();
          out.close();
  </code></pre>
  
  <p>I'm using Java 6. Do you know how I can accomplish step 4?</p>