Over a million developers have joined DZone.

Compare External Files in Eclipse

DZone's Guide to

Compare External Files in Eclipse

· Java Zone
Free Resource

Are you joining the containers revolution? Start leveraging container management using Platform9's ultimate guide to Kubernetes deployment.

Eclipse is very workspace centric: it only knows and deals with files in the workspace. So it is easy to compare and merge files present in the workspace: I select both files/folders and compare them with each other:

Compare with Each Other

Compare with Each Other

But what if the files and folders are NOT in the workspace?

Hidden Option to Compare External Files

As outlined in this post, it needs a special plugin to search for files outside the Eclipse workspace. And doing a file or folder compare outside of the workspace requires a trick as shown in this post.

Thanks to a tip from John there is another (hidden) way in Eclipse to compare external files:-)

Keyboard Shortcut

The trick is described in this article and requires a keyboard shortcut assigned.

Select the menu Window > Preferences > General > Keys and assign a shortcut key for ‘Compare with Other Resource‘:

Compare With Other Resource Key Binding

Compare With Other Resource Key Binding

(I’m using Ctrl+Shift+Home above).


To compare, I have first to select a file, folder or project, then I press my shortcut. Then the following dialog shows up (with the selection as default):

Select resource to compare

Select resource to compare

:idea: If the dialog does not show up, then I probably have not selected a file or folder in the Eclipse project view.

Now I can select the external files or folders to compare with:

Selected External Files

Selected External Files

With this, I can now compare and merge my files and folders with the Eclipse Compare view:

Compare View in Eclipse

Compare View in Eclipse

:idea: I can select two files/folders and then press the shortcut, and it will populate the search dialog values.

Drag & Drop

That compare dialog has a nice feature: I can drag&drop files and folders too:

C:\ProgramData\Processor Expert\CWMCU_PE5_00\Examples\FRDM-KL25Z\FRDM-KL25Z_RNet\Sources

C:\ProgramData\Processor Expert\CWMCU_PE5_00\Examples\FRDM-KL25Z\FRDM-KL25Z_RNet\Sources


With ‘Compare with Other Resource‘ I have a way to compare files/folders, and I’m not limited to the workspace files. The only disadvantage is that I need to assign a shortcut for it first. Beside of that: yet another hidden treasure in Eclipse :mrgreen: .

Happy Comparing :-)

Using Containers? Read our Kubernetes Comparison eBook to learn the positives and negatives of Kubernetes, Mesos, Docker Swarm and EC2 Container Services.


Published at DZone with permission of Erich Styger, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.


Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.


{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}