项目读取配置文件

配置文件读取问题

同包配置文件读取

this.getClass().getResourceAsStream("/img/logo.png");

image-20210208110138206

jar包提供给别的程序依赖,配置外部配置文件

pop.load(new FileInputStream(new File(this.getClass().getProtectionDomain().getCodeSource().getLocation().getPath()).getParent()+"/config.properties"));

image-20210208110331336

posted @ 2021-09-21 16:25  ynsocool  阅读(61)  评论(0)    收藏  举报