public static void create(String zipFilename, String... filenames) throws IOException
    {
        try (FileSystem zipFileSystem = createZipFileSystem(zipFilename, true))
        {
            final Path root = zipFileSystem.getPath("/");

            //iterate over the files we need to add
            for (String filename : filenames)
            {
                final Path src = Paths.get(filename);

                //add a file to the zip file system
                if (!Files.isDirectory(src))
                {
                    final Path dest = zipFileSystem.getPath(root.toString(), src.toString());
                    final Path parent = dest.getParent();
                    if (Files.notExists(parent))
                    {
                        System.out.printf("Creating directory %s\n", parent);
                        Files.createDirectories(parent);
                    }
                    Files.copy(src, dest, StandardCopyOption.REPLACE_EXISTING);
                }
                else
                {
                    //for directories, walk the file tree
                    Files.walkFileTree(src, new SimpleFileVisitor<Path>()
                    {
                        @Override
                        public FileVisitResult visitFile(Path file,
                            BasicFileAttributes attrs) throws IOException
                        {
                            final Path dest = zipFileSystem.getPath(root.toString(),
                                file.toString());
                            Files.copy(file, dest, StandardCopyOption.REPLACE_EXISTING);
                            return FileVisitResult.CONTINUE;
                        }

                        @Override
                        public FileVisitResult preVisitDirectory(Path dir,
                            BasicFileAttributes attrs) throws IOException
                        {
                            final Path dirToCreate = zipFileSystem.getPath(root.toString(), dir.toString());
                            if (Files.notExists(dirToCreate))
                            {
                                System.out.printf("Creating directory %s\n", dirToCreate);
                                Files.createDirectories(dirToCreate);
                            }
                            return FileVisitResult.CONTINUE;
                        }
                    });
                }
            }
        }
    }