本地一切正常,但是当我启动 jar 时,
我收到一个错误,提示它无法识别路径。
代码如下所示:
Path path = Paths.get(getclass().getclassLoader().getResource("classpath:images/" + image_title.getOriginalFilename()).toURI());
Files.copy(image_title.getInputStream(),path,StandardCopyOption.REPLACE_EXISTING);
错误:
2021-08-01 00:41:47.174 ERROR 13188 --- [nio-8080-exec-7] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.NullPointerException] with root cause
java.lang.NullPointerException: null