我正在尝试使用google-diff-match-patch,当我运行以下代码时,在 diff_match_patch$Diff 上获得 NoClassDefFoundError 。
import name.fraser.neil.plaintext.diff_match_patch.Diff;
import name.fraser.neil.plaintext.diff_match_patch.LinesToCharsResult;
import name.fraser.neil.plaintext.diff_match_patch.Patch;
...
public static void difftest(){
String string1 = "My first string";
String string2 = "My second string";
diff_match_patch dmp = new diff_match_patch();
LinkedList<Diff> diffs= dmp.diff_main(string1, string2);
String html = dmp.diff_prettyHtml( diffs);
System.out.println(html);
}
我查看了编译后的 diff_match_patch.class 和 diff_match_patch$Diff、diff_match_patch$Patch 和 diff_match_patch$LinesToCharsResult 都在那里。我从来没有对静态嵌套类有太多的运气,但我认为这就是问题所在。