I am reorganizing our java code base and wanted to compare our resultant jar files.
When I build in the old source tree, I get a jar file size of 3360081.
In the new source tree it is 3360128.
I do a "jar tvf jarfile" and then strip the dates out of the file.
The listing looks like this:
0 Mon Mar 16 10:41:16 EDT 2009 META-INF/
102 Mon Mar 16 10:41:14 EDT 2009 META-INF/MANIFEST.MF
0 Mon Mar 16 10:41:14 EDT 2009 decodes/
After I strip the dates, the listing looks like this:
0 META-INF/
102 META-INF/MANIFEST.MF
0 decodes/
The two jar listings are identical.
What would cause a 47 byte difference in "identical" jar files?
I am running the compile on RedHat Linux 4.
Jarcomp is a comparison tool for Jar files and Zip files. It's free and cross-platform. If you have two jar files or two zip files, it will show you what the differences are in the contents. It shows which files have been added, which have been removed, and which are present in both archives.
If you want to compare two zip files, you can use Java native libraries like ZipEntry. Or you can use any 3rd party utilities like Apache. You can get the list of files in one jar file and see if all the files are present in the other jar file. This way you will know the delta of the two jar files.
There is only a conflict if both jars define the exact same fully qualified class names. The JVM will most definitely load both jars - but it will not load classes from them that are already loaded.
A Java Archive, or JAR file, contains all of the various components that make up a self-contained, executable Java application, deployable Java applet or, most commonly, a Java library to which any Java Runtime Environment can link.
File modification times of the compiled files are most probably the reason. Also, your class files might actually be different. If you reorganized your package structure they most definitely will.
It's probably not the case - but by any chance are you using different compiler versions (even minor version differences) while compiling the two source bases?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With