I've written a simple shell script to generate "signatures" of all the
*.class
files in two JAR files and compare these with
diff
. The output is pretty well usable to spot the (sometimes accidental) differences between two versions of the same library.
I've tested the script on Ubuntu and Mac OS X, but it should work well on most Unix/Linux platforms. I've found it interesting that
javap
in OpenJDK was significantly faster than the
javap
in the Sun (now Oracle) JRE.
Running the script is pretty trivial:
jardiff.sh file1.jar file2.jar [output.diff]
The third parameter is optional. If not specified, the diff will be saved as
jardiff_yyyy-mm-dd_hh-mi-ss.diff
and the various date and time related fields are replaced with their actual values.
Comments
JarDiff v1.1.0
javap
's output. By default this command is asort
. This helps in cases where the order of class properties and functions changes between different versions of the containing JAR. This can happen if the class is automatically generated via some tool (eg. HyperJAXB). The order of a generated class's properties and functions might change regardless whether there's any "real" change to them (ie. in the property's/function's definition).JarDiff v1.2.0