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.
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.
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:
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.
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.
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: http://www.eclipseonetips.com/2013/09/19/compare-two-workspace-or-external-files-in-eclipse/
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): http://andrei.gmxhome.de/eclipse/
if one or both of the files you wish to compare isn't in an eclipse project:
open the quick access search box
- linux/windows: ctrl+3
- mac: ⌘+3
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
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..
- How do I compare two files using Eclipse? Is there any option provided by Eclipse?
- How to indent any XML files with two spaces (instead of tab) in Eclipse
- How can I make hidden files display in Eclipse Project explorer when using a RSE linked folder?
- How to switch the order of files (original and modified) in Eclipse Compare window?
- how to compare two methods in eclipse
- How to use external diff viewers in eclipse? Is there any diff viewer available for eclipse inbuilt?
- Are there any problems using Eclipse 3.6 with the Android SDK?
- How to add existing files to project using Eclipse and PyDev
- How to compare two files in Eclipse?
- How to dynamically link error pages to files in Eclipse using Play! Framework?
- Eclipse + Git - How to show only modified files in compare with option?
- Eclipse (3.5) how to compare files horizontally?
- How do I save a file using the Eclipse compare editor
- How do I transfer .apk files to device using Eclipse
- Why are there two pulls under 'Team' in Eclipse (Git) ? Any difference?
- How to share files among several Eclipse projects using SVN?
- How to make an eclipse plugin for text comparison of two files
- How to add referenced library JAR files using relative path for eclipse Java project in vscode
- How to compare two eclipse installations for missing features?
- How is Eclipse able to display a Java EE webapp using Tomcat, despite not placing any data in Tomcat's webapps folder?
- Is there any way to use GWT 2.9 with Java 11 using Eclipse GWT plugin?
- Is there a way of comparing two open files without using package explorer/project/navigator?
- eclipse - how to enable "mark occurrences" for any text and in all files
- eclipse juno, how can I associate currently opened files with a project or am I using eclipse outside the box?
- How to save files programmatically in Eclipse without using an editor?
- How do I set up Eclipse to run php files on my localhost using XAMPP?
- How to hot swap JSF xhtml files using Eclipse and WebLogic 11g without JRebel?
- how to synchronize two Eclipse parts using Jface
- How to compare only .c and .h files of two folders in Eclipse?
More Query from same tag
- ClassCastException when registering Saveable in UI thread
- Building dynamic web site with Java
- How to solve validation error on xsi:noNamespaceSchemaLocation in jdoconfig.xml
- I get "Source not found" when debugging my Java code in Eclipse
- Issues in eclipse editor
- Eclipse Google Plug-In doesn't start server for web application
- are libraries and natives part of resources?
- How to create a Wildfly 14 server in Eclipse?
- I can not connect actionbarsherlock to the project
- OSGI bundle version of SWT 4.4.2
- Javafx Mediaview settings according to scene property
- Generated signed Apk successfully but when I try to Run my project, I get an error
- Mac Eclipse GCC 4.9.0 "The program file specified in the launch configuration does not exist"
- Eclipse ADT: Java was started but returned exit code=13
- fopen fails while debugging in eclipse cdt
- What to put under Source Control in a Java Project
- Connect to bluetooth device from a listview
- How to fix error "Updating Maven Project". Unsupported IClasspathEntry kind=4?
- PyDev: Unresolved import
- Enable multithreading Eclipse C++
- Eclipse gets stuck when trying to launch Android app
- Change EJB project to web app
- GWT + Eclipse : refresh without restarting server
- Referencing to type, what is not in the build path
- SVN my project not showing up
- how build automatically works with eclipse using maven
- How to let maven resolve transitive dependency for local dependency
- Missing java build path option in eclipse
- Quick maven instal as a button in eclipse?
- Mockito fails in Maven but succeeds in Eclipse