How to overwrite one property in .properties without overwriting the whole file?

前端 未结 8 2121
逝去的感伤
逝去的感伤 2020-12-01 16:11

Basically, I have to overwrite a certain property in a .properties file through a Java app, but when I use Properties.setProperty() and Properties.Store() it overwrites the

8条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-01 16:23

    If you just want to override 1 prop why not just add parameter to your java command. Whatever you provide in your properties file they will be overrided with properties args.

    java -Dyour.prop.to.be.overrided="value" -jar  your.jar
    

提交回复
热议问题