Diff 库的使用
我的项目需要一个 diff 库。这正是我所需要的:http://code.google.com/p /google-diff-match-patch/ 但是当我下载该文件时,它没有附带 jar 文件。其中有源代码,我不太确定如何将其添加到我的应用程序中。有人知道如何在应用程序中使用它吗?我真的很感谢你的回答。
I need a diff library for my project. This is 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要添加到应用程序中的唯一内容是
diff_match_patch.java
文件。 (确保其许可证适合您的代码。)它没有任何依赖项,因此您可以简单地使用
javac diff_match_path.java
对其进行编译。diff_match_patch_test.java
使用 API(显然),因此您可以查看其中的示例,了解如何使用它/期望什么。 (测试类取决于 jUnit。)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.)如果你想将它分开并放在
lib/
文件夹下,然后创建一个新的 Eclipse 项目,将diff_match_patch.java
复制到 src 文件夹(当然还有包名),然后使用Eclipse的功能。通过这种方式,您可以将此文件作为 JAR 存档。这将提供一种简洁的方式来保持依赖关系的组织。
If you want to separate it and put under your
lib/
folder, then create a new Eclipse project, copydiff_match_patch.java
to src folder (with package name of course), then usefeature of Eclipse. By this way you can have this file as a JAR archive. This will provide a neat way to keep dependencies organized.