public String getJarPath() {
String path = this.getClass().getProtectionDomain().getCodeSource().getLocation().getPath();
if (System.getProperty("os.name").contains("dows")) {
path = path.substring(1, path.length());
}
if (path.contains("jar")) {
path = path.substring(0, path.lastIndexOf("."));
return path.substring(0, path.lastIndexOf("/"));
}
path = path.replace("target/classes/", "");
//路径中字符处理
return URLDecoder.decode(path, StandardCharsets.UTF_8);
}
上一篇

Git 文件超过了100M该怎么办?
2020-12-17
下一篇

Markdown使用Html丰富文本样式和图片属性
2020-12-15