Use WinMerge to compare *.class files

winmerge

I used to work with BeyondCompare and it was able to compare *.class files by configuring it to run a decompiler before comparison.

Is there something like that for WinMerge? Or a plug-in that can do it instead?

Best Answer

I have spent the day writing a DLL plugin for Winmerge to do this - it isn't the world's greatest thing, but it gets the job done.

Takes the filename, splits it into directory and class name, then calls javap for each class file. It is rather slow unfortunately (javap's fault I'd say).

I have put the DLL here:

https://www.dropbox.com/s/6hywu64zzj248t1/displayclassfiles.dll?dl=1

Absolutely no licence, warranty, etc. No trojans or virii either. I will get around to cleaning up the source and putting it up somewhere (probably with the winmerge project people).

Create a "MergePlugins" directory where your winmerge executable is and put the dll in there. It is automatically activated on *.class files.

The hardest part was working out how to launch javap, windows programming is just so awful.

It would be nice if winmerge compared the files before unpacking them to see if they are different - that would save a bit of time. Maybe this can be accomplished in the plugin somehow but as I said I really just hacked this together as quick as I could.

Oh I should mention you will need javap on your path.

EDIT: Source code is here: https://www.dropbox.com/s/gberx85pdcdlor2/unpackjavaclassfiles%20source.7z?dl=1 Built using visual studio 2005 - Adapted from DisplayBinaryFiles plugin which is available with winmerge source package.

Related Question