Friday, 8 August 2014

How to See difference between two Files in Eclipse - Text Comparision

One of the common task for every programmer is is to compare two files and find out difference between them. You would do this while comparing same file from different release version or from different environment to find out exactly what has changed. Though there are lot of good tools already exists to compare two files e.g. diff command in UNIX, Win Merge and Beyond compare in Windows, they are external tools. Beyond compare is not even free, but to be frank it's worth of money. I would like to compare two files directly from Eclipse to avoid switching to another program for a simple task. Actually, I have been using Beyond compare from long time, but I have practising to do every task ( which I can ) from Eclipse to save time by avoiding transition between multiple applications. This leads me to find out how do I compare two files in Eclipse, it could be Java source files, text files, or simply .properties or XML files. This search lead me to find the option I am going to share you with you guys here. I was very surprised that, even though I was using text comparison feature of Eclipse to see difference between local file with remote file in CVS, SVN, TFS and other source control systems in Eclipse for more than 5 to 6 years, I had missed this important feature to compare two totally unrelated files. This is a very good example of how much Java developer know about the IDE they use every day. There are many such features, and I am sure you guys can share something similar too. By using this "compare with each other option" you can just select two files and compare it right there in Eclipse itself.

No comments:

Post a Comment