背景: 最近在项目中遇到一个小问题, 几行代码就能解决了

 String path = this.getClass().getProtectionDomain().getCodeSource().getLocation().getFile();
try {
path = java.net.URLDecoder.decode(path, "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
String jarPath = new File(path).getParentFile().getAbsolutePath();

最新文章

  1. Win10命令提示符(cmd)怎么复制粘贴
  2. 2.5---链表来进行加法,链式A+B(CC150)
  3. Codeforces 543D Road Improvement(树形DP + 乘法逆元)
  4. Codeforces Round #235 (Div. 2)C、Team
  5. js中window.print()去除页眉页脚
  6. Linux下Scala(2.12.1)安装
  7. C语言gcc处理过程
  8. 借鉴 学习 DELPHI 通用函数 哈哈
  9. iPhone XS 能否经受的起寒冬的考验
  10. int &p
  11. 【MyBatis】解析MyBatis传入参数的问题
  12. Debian&&ubuntu系安装MegaCli
  13. Python168的学习笔记4
  14. 1-16-2 LVM管理和ssm存储管理器使用&磁盘配额
  15. CoderForces 687C The Values You Can Make (01背包,DP)
  16. 使用JavaScript OOP特性搭建Web应用
  17. 拖拽窗口的实现-JQuery实现;
  18. 【JeeSite】用户管理
  19. Hello to the cruel world
  20. python 局部local和全局global变量

热门文章

  1. 集合排序 Comparator和Comparable的使用区别
  2. FlowNet2.0 安装指南
  3. MySQL之路 ——1、安装跳坑
  4. Linux 网络侦错:无法联机原因分析
  5. Web.config设置system.webServer
  6. Ubuntu16下apache2安装ssl阿里云证书
  7. FFmpeg Scaler Options
  8. python字符串str和字节数组bytes相互转化
  9. j2cache笔记
  10. 分享几个Android很强势的的开源框架