Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to replace file in ear using unix

Tags:

unix

jar

I have a sample.ear file and I want to replace a particular file inside sample.ear.

consider ear file sample.ear which content com1/test1/file1.sh and com2/file2.sh  

here I want to replace file1.sh with updated file file1.sh using unix.

I am using jar command but i am not able to replace the file in subdirectories

Thanks

like image 531
DSD Avatar asked Nov 20 '13 10:11

DSD


People also ask

How do you update a JAR file?

The Jar tool provides a u option which you can use to update the contents of an existing JAR file by modifying its manifest or by adding files. In this command: The u option indicates that you want to update an existing JAR file. The f option indicates that the JAR file to update is specified on the command line.


1 Answers

Use:

jar -xf sample.ear com1/test1/file1.sh 

to extract file.sh. Once you are done modifying this com1/test1/file1.sh file use:

jar -uf sample.ear com1/test1/file1.sh

to update the archived ear with the modified file.

Use jar --help for detailed help.

like image 198
anubhava Avatar answered Oct 06 '22 11:10

anubhava