title: How to avoid FileSystemNotFoundException in java
body: <p>I have below code to copy the data from one file and paste in another, can someone please help me to avoid the exception **FileSystemNotFoundException **
  Thank you in anticipation....................................................................I have added the exception screenshot
  <a href="https://i.stack.imgur.com/QDyTK.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QDyTK.jpg" alt="enter image description here"></a></p>
  
  <pre><code> package com.mod2.zipIn;
  
      import java.io.*;
      import java.net.*;
      import java.nio.file.*;
      import java.nio.file.FileSystem;
      import java.util.*;
  
      public class ZipIn {
  
          public static void main(String[] args)
          {
              String[] data = {
                      "Line 1 ",
                      "Line 2 2 ",
                      "Line 3 3 3",
                      "Line 4 4 4 4",
                      "Line 5 5 5 5 5"
              };
  
  
              try (FileSystem zipFs  = openZip(Paths.get("mydata.zip"))){
                  copyToZip(zipFs);
              } catch (Exception e) {
                  System.out.println(e.getClass().getSimpleName() + " " + e.getMessage());
              }
          }
              private static FileSystem openZip(Path zipPath) throws IOException, URISyntaxException {
  
                  Map&lt;String, String&gt; providerProps = new HashMap&lt;&gt;();
                  providerProps.put("Create", "True");
  
                  URI zipURI = new URI("jar:file", zipPath.toUri().getPath(), null);
  
                  FileSystem zipFs = FileSystems.newFileSystem(zipURI,providerProps);
  
                  return zipFs;
              }
  
              private static void copyToZip(FileSystem zipFs)throws IOException {
                  Path sourceFile  = Paths.get("file1.txt");
                  Path destFile = zipFs.getPath("\file1Copied.txt");
  
                  Files.copy(sourceFile, destFile, StandardCopyOption.REPLACE_EXISTING);          
              }
          }
  </code></pre>