https://blog.csdn.net/aikesls/article/details/90484606 举例:查看DubboCheckOut.java所在的jar包路径 ProtectionDomain pd = DubboCheckOut.class.getProtectionDomain(); CodeSource cs = pd.getCodeSource(); System.out.println(cs.getLocation()); 输出:file:/D:/Maven_center/com/3rd/oracle/11.2.0.2.0/oracle-11.2.0.2.0.jar 这块代码可以用于查找项目Run时,其真正用的jar包路径。