0
点赞
收藏
分享

微信扫一扫

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

一只1994 2022-11-01 阅读 162


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

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

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

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

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

举报

相关推荐

0 条评论