title: java.nio.file.FileSystemNotFoundException when getting file from resources folder
body: <p>I am getting this error on the following code (note that this does not happen on my local machine, only on my build server):</p>
  
  <pre><code>Files.readAllBytes(Paths.get(getClass().getResource("/elasticsearch/segmentsIndex.json").toURI()), Charset.defaultCharset());
  </code></pre>
  
  <p>And the exception:</p>
  
  <pre class="lang-none prettyprint-override"><code>Caused by: java.nio.file.FileSystemNotFoundException: null
  at com.sun.nio.zipfs.ZipFileSystemProvider.getFileSystem(ZipFileSystemProvider.java:171)
  at com.sun.nio.zipfs.ZipFileSystemProvider.getPath(ZipFileSystemProvider.java:157)
  at java.nio.file.Paths.get(Paths.java:143)
  </code></pre>
  
  <p>I tried to fix it by following this <a href="https://stackoverflow.com/questions/25032716/getting-filesystemnotfoundexception-from-zipfilesystemprovider-when-creating-a-p">solution</a>; my code now looks like this:</p>
  
  <pre><code>URI segmentsIndexURI = getClass().getResource("/elasticsearch/segmentsIndex.json").toURI();
  Map&lt;String, String&gt; env = new HashMap&lt;&gt;(); 
  env.put("create", "true");
  FileSystem zipfs = FileSystems.newFileSystem(segmentsIndexURI, env); //exception here
  Path segmentsIndexPath = Paths.get(segmentsIndexURI);
  </code></pre>
  
  <p>I am getting the following exception:</p>
  
  <pre class="lang-none prettyprint-override"><code>java.lang.IllegalArgumentException: Path component should be '/'
  at sun.nio.fs.UnixFileSystemProvider.checkUri(UnixFileSystemProvider.java:77)
  at sun.nio.fs.UnixFileSystemProvider.newFileSystem(UnixFileSystemProvider.java:86)
  at java.nio.file.FileSystems.newFileSystem(FileSystems.java:326)
  at java.nio.file.FileSystems.newFileSystem(FileSystems.java:276)
  </code></pre>
  
  <p>Nothing seems to work.
  How am I supposed to build the path to the file?</p>