Take the 2-minute tour ×

I have an .ear file (an archive file like tar / zip) that has a file inside that i want to change.

For example myfile.ear contains 1.txt and i want to change 1.txt to 2.txt and possibly also change some of the content inside 1.txt (like sed does)

I really want to avoid having to extract myfile.ear, change the file and compress it again.

Does anyone know a way to achieve this in linux ?

And if it's not possible, I would also like to know why


share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

EAR files are just JAR files which are just ZIP files. The ZIP format, IIRC, contains metadata and data interleaved, so changing one file (which might be larger/smaller than the file it is replacing) might not fit (or leave a gap), thus in all practical terms the file must be rewritten when doing modifications.

share|improve this answer
is it possible then to extact only the specific file, modify it and put it back again ? or do i have to recompress everything again ? –  Michael Jun 14 '11 at 21:15
Any ZIP util I've ever used recreates the archive with those kinds of modifications. –  Joe Jun 15 '11 at 2:45
add comment

Your Answer


