使用java类加载器,报异常java.nio.file.InvalidPathException

String path = Label.class.getClassLoader().getResource("").getPath();

/F:/idea-Java/ImageDemo/out/production/ImageDemo

实质去掉最左边的斜杠就可以了。

String subpath = path.substring(1);

原文地址:https://www.cnblogs.com/zzq-include/p/11003134.html