Code Compare in EclipseStart the Eclipse IDE. In the Window menu select Preferences. In the tree area of the displayed Preferences window, expand the General node and navigate to the Compare/External Tool page. In this page, use the External diff executable field to specify the location of the Code Compare executable.
Right-click on the first file. Click on “Select for Compare” from the menu. Proceed to right-click on the second file. Click on “Compare with Selected.
Explanation: diff command is used for comparing files and displaying the differences between them.
To compare the contents of two files, we can use its contentEquals(…) method, which returns true only if the content of both files are equal or they both don't exist.
To compare two files in Eclipse, first select them in the Project Explorer / Package Explorer / Navigator with control-click. Now right-click on one of the files, and the following context menu will appear. Select Compare With / Each Other.
Just select all of the files you want to compare, then open the context menu (Right-Click on the file) and choose Compare With, Then select each other..
If one or both of the files you wish to compare isn't in an Eclipse project:
Open the Quick Access search box
Type compare and select Compare With Other Resource
Select the files to compare → OK
You can also create a keyboard shortcut for Compare With Other Resource by going to Window → Preferences → General → Keys
Other than using the Navigator/Proj Explorer and choosing files and doing 'Compare With'->'Each other'... I prefer opening both files in Eclipse and using 'Compare With'->'Opened Editor'->(pick the opened tab)... You can get this feature via the AnyEdit eclipse plugin located here (you can use Install Software via Eclipse->Help->Install New Software screen): http://andrei.gmxhome.de/eclipse/
If your compairing javascript you might find it not displaying.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=509820
Here is a workround...
- Window > Preferences > Compare/Patch > General Tab
- Deselect checkbox next to "Open structure compare automatically"
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