Accepted answer

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.

enter image description here


if you have beyond compare installed, the contextquickie eclipse plugin has an option to enable it to be selected from the context menu displayed when you right-click a file.

install from:

after install, activate beyond compare menu items via window->preferences->context quickie->check 'enable beyond compare'.


compare with other resource – the easy way using eclipse (no additional plugin required)

to assign a keyboard shortcut to the feature, go to window > preferences > general > keys, look for the command compare with other resource and assign it to a keyboard shortcut of your liking. see how to manage keyboard shortcuts in eclipse for more details on configuring shortcuts.

tip: alternatively, you could press ctrl+3 (for quick access) and search for compare with other resource. this way you don’t have to configure a shortcut but you’ll have to search for the command every time in quick access.

once the shortcut is assigned, you need to select the source file from the package explorer, project explorer or navigator. the easiest way to do this from an open editor is to assign a shortcut to instantly show the file in the package explorer or, if it’s not open, to open it quickly using the keyboard.


now press the keyboard shortcut you assigned to compare with other resource and the following (non-modal) dialog should appear:

compare with each other dialog

troubleshooting: if the dialog doesn’t appear, it’s probably because you haven’t selected a file in either the package explorer or another view that allows file selection. make sure a file is selected and make sure you haven’t selected the class in the package explorer rather than the actual java file.

now you can select the second file in the package explorer and drag and drop it onto the dialog. click ok and the comparison editor should display, comparing the two selected files.

comparison editor

tip: see the post on using shortcuts for common svn commands for tips on how to navigate the comparison editor with the keyboard.

comparing external files using the compare with other resource dialog, you can compare a workspace file with an external file or even compare two external files with each other.

comparing a workspace file with an external file is easy: once you’ve opened the dialog from a selected file, instead of dragging and dropping another workspace file, tick external file in the right pane and then browse to a file on your filesystem.

comparing external

to compare two external files, you have to start the dialog again from a selected workspace file (choose an arbitrary file). once open, select external file in the left pane and browse to your file then do the same for the right pane.

please refer this page for more details:


if your compairing javascript you might find it not displaying.

here is a workround...

  • window > preferences > compare/patch > general tab
  • deselect checkbox next to "open structure compare automatically"


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):


if one or both of the files you wish to compare isn't in an eclipse project:

  1. open the quick access search box

    • linux/windows: ctrl+3
    • mac: ⌘+3
  2. type compare and select compare with other resource

  3. select the files to compare → ok

you can also create a keyboard shortcut for compare with other resource by going to windowpreferencesgeneralkeys


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..

Related Query

More Query from same tag