尝试使用Java应用程序将jar文件中的某些文件复制到临时目录时,抛出以下异常:
java.nio.file.FileSystemNotFoundException
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(Unknown Source)
at com.sora.util.walltoggle.pro.WebViewPresentation.setupTempFiles(WebViewPresentation.java:83)
....
这是我的webViewPresentation(带有行号)的一小部分:
81. URI uri = getClass().getResource("/webViewPresentation").toURI();
//prints: URI->jar:file:/C:/Users/Tom/Dropbox/WallTogglePro.jar!/webViewPresentation
82. System.out.println("URI->" + uri );
83. Path source = Paths.get(uri);
webViewPresentation目录位于我的jar的根目录中:
仅当我将应用程序打包为jar时,此问题才存在,在Eclipse中进行调试没有问题。 我怀疑这与该错误有关,但是我不确定如何解决此问题。
任何帮助表示赞赏
如果重要:
我在Java 8 build 1.8.0-b132
Windows 7的Ult。 x64