title: How to continue program execution after an Exception is caught in Java
body: <p>My program loops through some folders and copies the files in the folder to a new file with a new name. Some files will copy and others will get a Java Exception saying access denied. When that happens the program terminates. I want it to skip and not copy that file and just keep going. Here is the copy function.</p>
  
  <pre><code>private static void copyFile(File source, File dest)
          throws IOException {
      FileChannel inputChannel = null;
      FileChannel outputChannel = null;
      try {
          inputChannel = new FileInputStream(source).getChannel();
          outputChannel = new FileOutputStream(dest).getChannel();
          outputChannel.transferFrom(inputChannel, 0, inputChannel.size());
      } catch (Exception e){
  
      }
  
  
          finally{
      inputChannel.close();
      outputChannel.close();
      }
  }
  </code></pre>
  
  <p>Any help would be great. Thanks!</p>