String path = getClass().getProtectionDomain().getCodeSource().getLocation().getPath();
获取jar包发布到服务器后的版本路径
String path = this.class.getProtectionDomain().getCodeSource().getLocation()
如果执行当前类.class会获取当前类绝对路径,,
如果打包成jar了,会获取当前jar的绝对路路径
String path = getClass().getProtectionDomain().getCodeSource().getLocation().getPath();
获取jar包发布到服务器后的版本路径
String path = this.class.getProtectionDomain().getCodeSource().getLocation()
如果执行当前类.class会获取当前类绝对路径,,
如果打包成jar了,会获取当前jar的绝对路路径