title: Copying a file.Finding a path to it
body: <p>I want to copy file to another directory.I know this has been asked million times,I read tons of answers about this but I just can't seem to make it work.This is the code I am currently using:</p>
  <pre><code>copyFile(new File(getClass().getResource(&quot;/jars/TurnOffClient.jar&quot;).toString()),
     new File(&quot;C:\\Documents and Settings\\All Users\\Start Menu\\Programs\\Startup\\karioc.jar&quot;));
  </code></pre>
  <p>And this is the method:</p>
  <pre><code>public static void copyFile(File sourceFile, File destFile) throws IOException {
      if(!destFile.exists()) {
          destFile.createNewFile();
      }
  
      FileChannel source = null;
      FileChannel destination = null;
  
      try {
          source = new FileInputStream(sourceFile).getChannel();
          destination = new FileOutputStream(destFile).getChannel();
          destination.transferFrom(source, 0, source.size());
      }
      finally {
          if(source != null) {
              source.close();
          }
          if(destination != null) {
              destination.close();
          }
      }
  }
  </code></pre>
  <p>This is my dir:
  <a href="http://imageshack.com/a/img820/6418/5g3m.png" rel="nofollow noreferrer">Directories http://imageshack.com/a/img820/6418/5g3m.png</a></p>
  <p>//////////////////////////////////////////////////////////////////////////////////////////
  And this is the exception I get:
  <a href="https://i.stack.imgur.com/1zvvJ.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1zvvJ.jpg" alt="Exception" /></a></p>