I want to compare two text files and want to highlight the differences. Can any one of you help me in doing that thro Java program.
Thanks in advance.
The google-diff-match-path library seems to provide the functionality you need. Here's a demo of it in action.
In Eclipse right click on filename in navigator bar, then select "Compare With".
aioobe
Copying one of my answers from a related question:
I would go for netbeans diff api.
From the later url:

Although not a visual implementation, you also have a translation of gnu diff in java.
来源:https://stackoverflow.com/questions/3573480/file-compare-and-highlight-java