Java :如何在运行时修改config.properties?


我有一个有值的键。

autoFixBasePath=C:/myTest

我希望将autoFixBasePath附加到一些向下声明的键后面:

因此,我尝试在开始时设置autoFixBasePath的值,然后修改配置文件:

    try {
        PropertiesConfiguration config = new PropertiesConfiguration("config.properties");
        config.setProperty("autoFixBasePath", args[2]);
        config.save();
    }catch (Exception exception){

    }

这在本地是有效的,但是当使用maven汇编插件时,我已经将配置文件放在jar中,在那里它失败了。

我该怎么做呢?

转载请注明出处:http://www.mrdmz.com/article/20230526/2054900.html