FileSystemNotFoundException FileSystems.getFileSystem

时间:2015-06-29 11:57:42

标签: java nio

FileSystems.getFileSystem在ZipFileSystemProvider.java:171行抛出FileSystemNotFoundException

我该怎么做才能克服这个问题? 提前谢谢......

public void copy(File sourceFile){
Path zipfile = Paths.get(sourceFile.getAbsolutePath());
URI uri = URI.create("jar:" + zipfile.toUri());
FileSystem fs = FileSystems.getFileSystem(uri);
Path nf = fs.getPath("new.txt");
.....    

}

1 个答案:

答案 0 :(得分:0)

根据Oracle documentation,正确的uri前缀为jar:file: