3

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.

Sean Patrick Floyd
  • 292,901
  • 67
  • 465
  • 588
Nitin
  • 39
  • 1
  • 1
  • 2
  • 2
    There are java diff classes scatered all around the internet. i'm sure you could find one by simply typing "java file diff" – Riduidel Aug 26 '10 at 08:56

3 Answers3

1

Copying one of my answers from a related question:


I would go for netbeans diff api.

From the later url:

enter image description here

Although not a visual implementation, you also have a translation of gnu diff in java.

Community
  • 1
  • 1
aioobe
  • 413,195
  • 112
  • 811
  • 826
1

The google-diff-match-path library seems to provide the functionality you need. Here's a demo of it in action.

Dónal
  • 185,044
  • 174
  • 569
  • 824
1

In Eclipse right click on filename in navigator bar, then select "Compare With".

Boris
  • 305
  • 2
  • 15