我按照这个页面的说明操作,但无法使其工作。我想要在test.zip中创建一个名为“new”的文件夹。每当我运行下面的代码时,它都会给出一个
FileAlreadyExistsException
错误,并且只会创建一个空的zip文件。 Map<String, String> env = new HashMap<>();
env.put("create", "true");
Path path = Paths.get("test.zip");
URI uri = URI.create("jar:" + path.toUri());
try (FileSystem fs = FileSystems.newFileSystem(uri, env)) {
Path nf = fs.getPath("new/");
Files.createDirectory(path);
} catch (IOException e) {
e.printStackTrace();
}