The simplest option would be to calculate a hash (MD5 for example) from the.jar file's raw bytes and compare those. You could also, read the.jar files' contents using java.util.jar. and do the same hash comparison for each file individually (filtering out any irrelevant files). If the hashing stuff doesn't seem to fit, you could try exploding the jar files somewhere, run a decompiler on them, and then compare the resulting source files.
How do I compare two .jar files? Both of them have compiled .class files.
I want the difference in terms of method changes, etc.
linuxbuild11 Answers
JAPICC, sample usage:
japi-compliance-checker OLD.jar NEW.jar
Sample reports for log4j: http://abi-laboratory.pro/java/tracker/timeline/log4j/
PkgDiff, sample usage:
pkgdiff OLD.jar NEW.jar
See sample report for args4j.
Clirr, sample usage:
java -jar clirr-core-0.6-uber.jar -o OLD.jar -n NEW.jar
- Rename .jar to .zip
- Extract
- Decompile class files with jad
- Recursive diff
If you select two files in IntellijIdea and press Ctrl + D
then it will show you the diff. I use Ultimate and don't know if it will work with Community edition.
I use to ZipDiff lib (have both Java and ant API).
FoxyBOAFoxyBOAExtract each jar to it's own directory using the jar command with parameters xvf. i.e. jar xvf myjar.jar
for each jar.
Then, use the UNIX command diff
to compare the two directories. This will show the differences in the directories. You can use diff -r dir1 dir2
two recurse and show the differences in text files in each directory(.xml, .properties, etc).
This will also show if binary class files differ. To actually compare the class files you will have to decompile them as noted by others.
BrianBrianHere is my script to do the process described by sje397:
I can run it on Windows using GIT for Windows. Just open a command prompt. Run bash and then execute the script from there.
Use Java Decompiler to turn the jar file into source code file, and then use WinMerge to perform comparison.
You should consult the copyright holder of the source code, to see whether it is OK to do so.
Cheok Yan ChengCheok Yan ChengHere's an aparently free tool http://www.extradata.com/products/jarc/
TomTomPlease try http://www.osjava.org/jardiff/ - tool is old and the dependency list is large. From the docs, it looks like worth trying.
JayanJayanuse java decompiler and decompile all the .class files and save all files as project structure .
then use meld diff viewer and compare as folders ..
![How to compare 2 jar files size How to compare 2 jar files size](https://i.stack.imgur.com/6MtCl.jpg)
Not the answer you're looking for? Browse other questions tagged javajarcomparisondiff or ask your own question.
Find the diff between 2 files using this file compare tool.
- filecompareetocomparefilesvaluation.exe
- Compare 2 text files or 2binary software
- Freeware (Free)
- 1.95 Mb
- Win95, Win98, WinME, WinNT 4.x, WinXP, Windows2000
Have you ever wanted to compare two different files quickly, but haven't had the tools you need? Then this software is for you! Download the file compare software for free and try it now! This software features: * The ability to easily compare. ...
- filecompareetocomparefilesvaluation.exe
- File comparison software tocompare two text or binaryfiles!
- Freeware (Free)
- 1.95 Mb
- Win95, Win98, WinME, WinNT 4.x, WinXP, Windows2000
CompareFiles 1.0 comes as a greatly proper utility which allows you to compare any two files by just drag and drop. CompareFiles helps you to compare two files. It checks the content of the file and inform the user that the selected files are same. ...
- Compare Files
- AJ WeB
- Freeware (Free)
- 340 Kb
- Windows Vista, Windows Server 2008, Windows X
One-JAR(TM) is a simple solution to a vexing problem in Java: how to distribute an application as a single jar-file, when it depends on multiple other jar-files. One-JAR uses a custom classloader to discover library jarfiles inside the main. ...
- one-jar-appgen-0.97.jar
- one-jar
- Freeware (Free)
- 306 Kb
- Windows; Mac; Linux
this is an unofficial project which pack and distribute 3rd party jarfiles for Slackware linux. .SlackBuild scripts are also available; if you need java resources for your Slackware box, this is the right. ...
- junit-4.4-noarch-1sjpi.tgz
- slackjarpack
- Freeware (Free)
- 243 Kb
- Linux
A Jar comparison utility as a standalone tool as well as an Ant task. The comparison results can be exported to a .html, .pdf, .xls, .rtf formats.With the Ant task, build systems can verify 2 versions for differences in the contents of jarfiles. ...
- Jar Comparator Tool
- Pradeep Kadambar
- Freeware (Free)
- Windows
Duplicates Finder is extremely simple tool which can be used to compare two files line-by-line (or word-by-word) for duplicates. Just a toy I made for my own use, but decided to publish for anyone interested.
- duplicatesFinder.exe
- WonderWebWare.com
- Freeware (Free)
- 535 Kb
- Win95, Win98, WinME, WinNT 4.x, WinXP, Windows2000, Windows2003, Windows Vista
a Java utility for comparing the contents of any two zip files. It can also be used to compare EAR files, WAR files, or JAR. ...
- zipdiff-0.4.zip
- zipdiff
- Freeware (Free)
- 61 Kb
- Windows; Mac; Linux
EXcompCEL is an easy to use Java desktop application that will help you compare Excel files. FEATURES: · Compare Excel Files · Drag & Drop · Written in Java · Java Swing · Apache Poi · Java Desktop Application · Java Webstart ·. ...
- EXcompCELv0.8.zip
- Detlev Struebig
- Freeware (Free)
- 14 Mb
- WinXP, Windows Vista, Windows 7, Windows 7 x64
Jnix is a Launch4J compatible utility for wrapping jarfiles in shell scripts for deployment on Linux and Unix. It can also serve as a launcher script for jar. ...
- Jnix1.2inst.exe
- halogenware
- Freeware (Free)
- Windows2000, WinXP,Windows Vista
Bottomline is a JDBC Bridge API that loads database drivers directly from JAR archives with (JCL) Jar Class Loader. Bottomline uses a jdbc:bottomline bridge to load multiple drivers from their respective JARfiles. Unlike JDBC, Bottomline uses custom. ...
- Bottomline
- Xeus Technologies
- Freeware (Free)
- 375 Kb
- Windows 2003, XP, 2000, 98
Text Files Differer. Allows visually compare text files and synchronize them by copying and deleting of blocks with differences. KOLDiffer is a small, simple and easy-to-use Text Files Differer. KOLDiffer allows you to visually compare text files and. ...
- KOLDiffer
- Alex Shakhaylo
- Freeware (Free)
- 79 Kb
- Windows All
Related:Compare Jar Files - Jar Compare Tool - Download Jar Compare - Compare Xl Files - Files Compare Bin
![Files Files](https://s3.amazonaws.com/noupe/trans/wp-content/uploads/2011/06/comparepdf.jpg)