d0x d0x - 4 months ago 27
Java Question

How to edit the content of an application.properties or application.yml file inside an existing jar on a remote Linux server

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?

Answer

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.