View RSS Feed

My Java Tips

Comparing files

Rate this Entry
by , 11-10-2011 at 05:24 PM (639 Views)
While working on projects, sometimes you wish to see the changes you made since last version of the file. This is important to rollback changes or simple to know what new has been added or what has been removed. Eclipse provides a useful feature for this very purpose. In this post, I will write about compare feature.

Whenever you save a Java file, Eclipse keep a copy of the older one if this feature is enabled. This is required for comparing files in case you need that. To view the history of a Java class, simply right click the file and click Show in > History. You will be shown all the revision times of the Java class.
Name:  history.PNG
Views: 38
Size:  4.9 KB
To compare the current Java class with some old version, right click the class and choose Compare with > Local history. Now you have to choose the version of the file with which you want to compare. After choosing, you will be shown both files in a window like this:
Name:  changes.PNG
Views: 42
Size:  17.1 KB
The added code will be highlighted. You make rollback the changes if you want.

Comparing files is a simple but useful feature provided by Eclipse. Explore it and use it when needed.

Submit "Comparing files" to Facebook Submit "Comparing files" to Digg Submit "Comparing files" to Submit "Comparing files" to StumbleUpon Submit "Comparing files" to Google