How was Rt.jar created for JRE 1.6?

advertisements

So here is what I did -

I unzipped the contents of rt.jar into a folder called rt. Then, inside rt folder, I executed the following jar command

jar cf rt.jar *

This should create a jar file with the same classes as that in the original rt.jar file.

However, the file sizes of the two files are significantly different.

Original rt.jar      -> 43.1 MB
Newly created rt.jar -> 20.6 MB

Note that the size of the unzipped contents for both the jar files is the same. This makes me think that the original rt.jar wasn't created using the jar command. So how was it created?


The original jar is created with 0 compression level to make loading classes less CPU intensive.

> unzip -v rt.jar
Archive:  rt.jar
 Length   Method    Size  Cmpr    Date    Time   CRC-32   Name
--------  ------  ------- ---- ---------- ----- --------  ----
       0  Stored        0   0% 02-03-2012 21:20 00000000  META-INF/
    2343  Stored     2343   0% 02-03-2012 21:20 a653ef50  META-INF/MANIFEST.MF
     754  Stored      754   0% 02-03-2012 21:12 fa8ba6d9  com/oracle/net/Sdp$1.class
     350  Stored      350   0% 02-03-2012 21:12 ca729c09  com/oracle/net/Sdp$SdpSocket.class
...