title: Creating a Zip File System Provider in Java
body: <p>From <a href="http://docs.oracle.com/javase/7/docs/technotes/guides/io/fsp/zipfilesystemprovider.html" rel="nofollow">offical docs</a>, I have this small program:</p>
  
  <pre><code>import java.util.*;
  import java.io.File;
  import java.net.URI;
  import java.nio.file.*;
  
  public class ZipFSPUser {
      public static void main(String [] args) throws Throwable {
  
          Map&lt;String, String&gt; env = new HashMap&lt;&gt;(); 
          env.put("create", "true");
  
          URI uri = (new File(args[0])).toURI();
          FileSystem fs = FileSystems.newFileSystem(uri, env);
  
      }
  }
  </code></pre>
  
  <p>I call it in the Mac terminal like</p>
  
  <pre><code>java -jar app.jar path/to/some/file.zip
  </code></pre>
  
  <p>But it says</p>
  
  <blockquote>
    <p>Path component should be '/'</p>
  </blockquote>
  
  <p>So then I decided to write the path myself:</p>
  
  <pre><code>URI uri = URI.create("file://path/to/my/file.zip");
  </code></pre>
  
  <p>And now it says</p>
  
  <blockquote>
    <p>java.lang.IllegalArgumentException: Authority component present</p>
  </blockquote>