6

I'm using Beyond Compare 4 (4.1.9) in order to compare war files.

I need to compare the files .class that I find in the several packages.

  1. How I can compare them using this product (Beyond Compare 4)?
  2. Otherwise there is another product which can compare war file and compile the .class files?
diyoda_
  • 5,274
  • 8
  • 57
  • 89
pacio14
  • 351
  • 1
  • 8
  • 18

4 Answers4

12

Double clicking on a war file in Beyond Compare's folder compare will expand it as a folder because war files are essentially zip files.

To decompile Java class files to source code in Beyond Compare, install the Java Class to Source file format. With the file format installed, when you double click on a .class file inside a .war archive, it will display the decompiled source code in Beyond Compare's Text Compare.

Download page for file formats: http://www.scootersoftware.com/download.php?zz=kb_moreformatsv4

Note the Java class to source file format is only available for Windows, it isn't available for the Linux or Mac versions of Beyond Compare.

Chris Kennedy
  • 2,639
  • 12
  • 11
4
  1. Download Java Class to Source file format from http://www.scootersoftware.com/download.php?zz=kb_moreformatsv4

  2. In Beyond Compare, pick Tools | Import Settings.

  3. Fill in the downloaded filename, and click Next and proceed to finish.

ChandraBhan Singh
  • 2,841
  • 1
  • 22
  • 27
2

Option : javap -l -p -c -constants %s > %t 2>&1 : doesn't work for me on beyondCompare4 4.3.7 (latest version to this date), and if used directly through cmd, gives a .class output but the formatting is bad and it is not really interpretable for the java reader I am.

Option to download the format through http://www.scootersoftware.com/download.php?zz=kb_moreformatsv4 : doesn't work for me neither. This library is based http://varaneckas.com/jad which is quite old.

The option I recommend and that worked is : Download https://github.com/kwart/jd-cli (project based from the famous "Java Decompiler" or "jd-gui" as we know it). Once it is installed, do the following in BeyondCompare4 : Go in format, create a new format, use external program, and use the following : C:\Users%USERNAME%\jd-cli-1.2.0-dist\jd-cli.bat %s > %t 2>&1

Hope this will help some.

Codizon
  • 397
  • 1
  • 4
  • 12
0

I recently came across the need to compare class files in Beyond Compare 4 and so I found that adding an external program and using javap -l -p -c -constants %s > %t 2>&1 was enough for me. Just make sure a reasonably recent javap is one the PATH that understands any of the class file formats you'd want to compare. No extra software required and is cross platform compatible.

Ray
  • 1,324
  • 10
  • 18