来自Jar的路径文件

时间:2013-07-09 14:28:09

标签: jar path classloader nio java-7

我在复制jar中的文件时遇到问题:

URI ink2_1 = this.getClass().getClassLoader().getResource("Masi_INK2.bmp").toURI();
...
Files.copy(Paths.get(sourceFile1), Paths.get(IAIOutputFile+requestId+"_INK1.bmp"));

路径

无法解析路径
15:43:11,505 INFO  [MainFake] searching for jar:file:/C:/workspace/clone/Tools/DummySimulator/DummySimulator-1.0-SNAPSHOT.jar!/Masi_INK2.bmp
15:43:11,505 INFO  [MainFake] Exception in thread "main" 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.example.MainFake.processImages(MainFake.java:101)

1 个答案:

答案 0 :(得分:3)

This bug仍然存在于7u25。