For homework and projects, it may be useful to compare actual and expected output files side-by-side. Eclipse has a nice comparison view that will align the files and highlight the differences, even differences in whitespaces that may be otherwise difficult to see.
Opening Compare View
To open this view, follow these steps:
-
Control + Click or Command + Click the two files you want to compare so that they are both highlighted in the Project Explorer view.
-
Right-click one of the selected files. This should open up a menu.
-
Select “Compare With” from the menu.
-
Select “Each Other” from the sub-menu.
Comparison View
The two files will be displayed side-by-side. If it is a long file, Eclipse will synchronize scrolling of the files.
Any differences between the two files will be highlighted. This is especially helpful to find difference in whitespaces.
You can also use the buttons on the top right to step through all of the differences in the file. This is useful for large files when it isn’t clear where to find the differences.