How to edit a property file (like application.properties) inside of an existing jar file on a remote Linux server.
Imagine the jar is located in /home/user/my-spring-boot.jar and I like to change the username inside of application.propertires from
username=foo to
username=bar How to open the file and change the property?
Use 7zip, right click on jar and with 7z say open archive, then go to property file, double click and open file with notepad, edit it and save. Now when you will close 7z console, it will ask "update archive?" Say yes... That's it.
To read from the application. yml or property file : The easiest way to read a value from the property file or yml is to use the spring @value annotation.
A .jar file is simply a .zip file with a different extension, and vim can edit zip files and their contents directly! Simply vim your .jar, use the file navigator to find your properties file and change it. vim will maintain the zip with your edits.
See here for more details.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With