获取jar包发布到服务器后的版本路径

阅读 163

2022-11-01


String path = getClass().getProtectionDomain().getCodeSource().getLocation().getPath();

获取jar包发布到服务器后的版本路径

String path = this.class.getProtectionDomain().getCodeSource().getLocation()

如果执行当前类.class会获取当前类绝对路径,,

如果打包成jar了,会获取当前jar的绝对路路径

相关推荐

精彩评论(0)

0 0 举报