📅  最后修改于: 2022-03-11 14:52:10.164000             🧑  作者: Mango
//this worked for me
File jarDir = new File(ClassLoader.getSystemClassLoader().getResource(".").toURI());
//this didn't work for me but it is often suggested
File jar = new File(MyClass.class.getProtectionDomain().getCodeSource().getLocation().toURI());