1

I want to add a particular class file in an EAR file.

My EAR has many JAR file. In a particular JAR i want to delete an MyJavaClassFile.class and an updated(fix) MyJavaClassFile.class in the same place as previous.

I have a test.ear. I tried to unzip and zip it mentioned in this link

jar -xvf test.ear

jar -cvf test.ear yourclassesdir 

but there is difference in checksum between (test.ear) and (test.ear --> test/ --> test.ear)

Am I correct with these steps ? If I am wrong guide me..

Community
  • 1
  • 1
theRoot
  • 571
  • 10
  • 33

1 Answers1

0

You definitely did the compression and decompression correctly, I believe the md5 checksum changed due to restructuring of the test.ear after recompression. You have the exact same bytes inside your test.ear but they are now in a slightly different order.

dbenson
  • 326
  • 1
  • 4
  • is there any other way i can achieve the replacement of class file via command line with same checksum – theRoot Jul 31 '15 at 10:48
  • No. If you modify any contents of the .ear no matter how small the edit the entire checksum will change. This is why many people use md5 checksums to ensure the integrity of files they download. – dbenson Jul 31 '15 at 10:51
  • are you sure that my ear file doesn't get affected? – theRoot Jul 31 '15 at 11:04
  • What do you mean by affected? If you make changes to it then its going to be affected. – dbenson Jul 31 '15 at 15:26
  • Note : at first I tried to just unpack and repack the same ear **without modifying anything** ..By doing this in my assumption should be same ..am I correct..? – theRoot Aug 01 '15 at 10:45