title: Error in Java : java.io.FileNotFoundException: C:\Users\FSSD\Desktop\My Test (Access is denied)
body: <p>I have a java code for copy file from one folder to another folder. I used the following code (I used Windows 7 operating system),</p>
  
  <p><strong>CopyingFolder.java</strong></p>
  
  <pre><code>import java.io.File;
  import java.io.FileInputStream;
  import java.io.FileOutputStream;
  import java.io.IOException;
  import java.nio.channels.FileChannel;
  
  
  public class CopyingFolder {
  
      /**
       * @param args
       */
      public static void main(String[] args) {
          // TODO Auto-generated method stub
          File infile=new File("C:\\Users\\FSSD\\Desktop\\My Test");
          File opfile=new File("C:\\Users\\FSSD\\Desktop\\OutPut");
          try {
              copyFile(infile,opfile);
          } catch (IOException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
      }
      private static void copyFile(File sourceFile, File destFile)
              throws IOException {
      if (!sourceFile.exists()) {
              return;
      }
      if (!destFile.exists()) {
              destFile.createNewFile();
      }
      FileChannel source = null;
      FileChannel destination = null;
      source = new FileInputStream(sourceFile).getChannel();
      destination = new FileOutputStream(destFile).getChannel();
      if (destination != null &amp;&amp; source != null) {
              destination.transferFrom(source, 0, source.size());
      }
      if (source != null) {
              source.close();
      }
      if (destination != null) {
              destination.close();
      }
  
  }
  
  }
  </code></pre>
  
  <p>While I'm using the above code I got the following Error. Why it will arise? how can I resolved it?</p>
  
  <pre><code>java.io.FileNotFoundException: C:\Users\FSSD\Desktop\My Test (Access is denied)
      at java.io.FileInputStream.open(Native Method)
      at java.io.FileInputStream.&lt;init&gt;(FileInputStream.java:106)
      at CopyingFolder.copyFile(CopyingFolder.java:34)
      at CopyingFolder.main(CopyingFolder.java:18)
  </code></pre>