How to replace a file in jar with command line in linux?

Solution 1:

zip -u stuff.jar file.txt

will update file.txt in stuff.zip . Note that for -u file.txt must already exist in the zip file, and will only be overwritten if it's newer than the one in the jar.

Solution 2:

what about this one

jar -uf YOURJAR.jar FILE

if the jar have a folder structure, you can keep that too

jar -uf YOURJAR.jar DIR/DIR/FILE

Look this one for more information http://docs.oracle.com/javase/tutorial/deployment/jar/update.html