title: NoSuchFileException adding file to ZIP using Java NIO
body: <p>I have a frustrating issue using the Java NIO to add files to existing ZIPs.</p>
  
  <p>On a test of 2500 files, 2 or 3 will fail. I am adding files to the root of the ZIP and not in a subfolder (which appears to be the source of some issues in other posts).</p>
  
  <p>The weird thing is that the file cited in the exception message it claims doesn't exist is neither the ZIP or the file being added, but the temporary file created by Java as it builds a new ZIP file. Here is the code (less the try/catch):</p>
  
  <pre><code>Map&lt;String, String&gt; zipProps = new HashMap&lt;&gt;();
  zipProps.put("create", "false");
  zipProps.put("encoding", "UTF-8");
  FileSystem zipFs = null;
  
  URI zipAsFileSys = new URI("jar", fileToArchive.toURI().toString(), null);
  zipFs = FileSystems.newFileSystem(zipAsFileSys, zipProps);
  Path pathToNewFileInZip = zipFs.getPath(fileIdFile.getName());
  Path pathToNewFileOnDisk = Paths.get(fileIdFile.getAbsolutePath());
  Files.createFile(pathToNewFileInZip ); //Added later. No difference.
  Files.copy(pathToNewFileOnDisk, pathToNewFileInZip, StandardCopyOption.REPLACE_EXISTING);
  if(zipFs!=null) zipFs.close(); 
  </code></pre>
  
  <p>And the exception:  </p>
  
  <pre><code>Exception: java.nio.file.NoSuchFileException: \\Server\archives\zipfstmp7224673021628877485.tmp
  </code></pre>