直接运行 main 函数,以下代码是可以执行的
URL res = getClass().getClassLoader().getResource(scriptPath);
try (Stream<String> stream = Files.lines(Paths.get(res.toURI()), StandardCharsets.UTF_8)) {
stream.forEach(s -> contentBuilder.append(s).append("\n"));
} catch (IOException | URISyntaxException e) {
hrow new Exception("script file missing.", e);
}
Nutz Boot 打包后就找不到文件了
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(Paths.java:143)
请问如何处理?