title: Is there a way to replace an html file with another one by coding in Java?
body: <p>My purpose is to replace an html file in a folder by another one, so that at the end :</p>
  
  <p><code>html_link1</code> will be replaced by <code>html_link2</code></p>
  
  <p>Is there a way to update HTML files by executing code in Java ?</p>
  
  <pre><code>public static void main(String[] args)  {
  
      Path sourceDirectory = Paths.get("C:/Users/Me/Desktop/project/adresse.url");
      Path targetDirectory = Paths.get("C:/Users/Me/Desktop/project/adresse2.url");
  
      //copy source to target using Files Class
      try {
          Files.copy(sourceDirectory, targetDirectory,StandardCopyOption.REPLACE_EXISTING);
      } catch (IOException e) {
          System.out.println(e.toString());
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>I need to find a way to change the URL, since the Path are now the same, the URL of the second HTML file didn't changed</p>