问题
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.
回答1:
The google-diff-match-path library seems to provide the functionality you need. Here's a demo of it in action.
回答2:
In Eclipse right click on filename in navigator bar, then select "Compare With".
回答3:
Copying one of my answers from a related question:
I would go for netbeans diff api.
- How to use the diff api in netbeans and,
- 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