开发者

Usage of a Diff library

开发者 https://www.devze.com 2023-03-07 22:43 出处:网络
I need a diff library for my project. This i开发者_如何学Cs exactly what i need: http://code.google.com/p/google-diff-match-patch/

I need a diff library for my project. This i开发者_如何学Cs exactly what i need: http://code.google.com/p/google-diff-match-patch/ But when i download the file it doesnt come with a jar file. There are source codes in it and i'm not quite sure how to add this into my application. Anyone knows how to use this in an application? I really appreciate an answer.


The only thing you need to add to your application is the diff_match_patch.java file. (Make sure its license is appropriate for your code.)

It doesn't have any dependencies so you can simply compile it with javac diff_match_path.java.

The diff_match_patch_test.java uses the API (obviously) so you can look in there to see examples of how to use it/what to expect. (The test class depends on jUnit.)


If you want to separate it and put under your lib/ folder, then create a new Eclipse project, copy diff_match_patch.java to src folder (with package name of course), then use

 File->Export->JAR

feature of Eclipse. By this way you can have this file as a JAR archive. This will provide a neat way to keep dependencies organized.

0

精彩评论

暂无评论...
验证码 换一张
取 消