code: public static final void copyResource(String source, Path target, Class<?> cls) throws IOException
      {
          try (InputStream is = cls.getResourceAsStream(source))
          {
              Files.copy(is, target, REPLACE_EXISTING);
          }
      }
docs: Copies class resource to path
  @param source As in getResourceAsStream
  @param target Target file
  @param cls A class for finding class loader.
  @throws IOException
  @see java.lang.Class#getResourceAsStream(java.lang.String)