XXX为当前类名
public static String currentJarPath() throws URISyntaxException {
ProtectionDomain protectionDomain = XXX.class.getProtectionDomain();
CodeSource codeSource = protectionDomain.getCodeSource();
File jarFile = new File(codeSource.getLocation().toURI().getPath());
System.out.println(jarFile.getParentFile().getPath());
return jarFile.getParentFile().getPath();
}