java获取jar包执行路径

参考:https://stackoverflow.com/questions/320542/how-to-get-the-path-of-a-running-jar-file

 

String path =  this.getClass().getProtectionDomain().getCodeSource().getLocation().getPath();
String decodedPath = URLDecoder.decode(path, "UTF-8");
posted @ 2021-09-05 00:09  梦醒江南·Infinite  阅读(377)  评论(0编辑  收藏  举报