code: public static void copyResource(String resource, File destination) throws IOException {
          InputStream is = null;
          FileOutputStream fos = null;
  
          try {
              is = FileUtils.class.getResourceAsStream("/" + resource);
              fos = new FileOutputStream(destination);
  
              final byte[] buffer = new byte[10 * 1024];
              int len;
              while ((len = is.read(buffer)) > 0) {
                  fos.write(buffer, 0, len);
              }
          } finally {
              close(is);
              close(fos);
          }
  
      }
docs: Copy a classpath resource to a destination file.
  
  @param resource    Path to resource to copy.
  @param destination File to copy resource to.
  @throws IOException exception2