具体错误:
java.lang.RuntimeException: Could not initialize English chunker at org.languagetool.chunking.EnglishChunker.<init>(EnglishChunker.java:72) at org.languagetool.language.English.createDefaultChunker(English.java:123) at org.languagetool.Language.getChunker(Language.java:476) at org.languagetool.JLanguageTool.getRawAnalyzedSentence(JLanguageTool.java:1479) at org.languagetool.JLanguageTool.getAnalyzedSentence(JLanguageTool.java:1444) at org.languagetool.JLanguageTool.analyzeSentences(JLanguageTool.java:1172) at org.languagetool.JLanguageTool.check(JLanguageTool.java:899) at org.languagetool.JLanguageTool.check(JLanguageTool.java:882) at org.languagetool.JLanguageTool.check(JLanguageTool.java:869) at org.languagetool.JLanguageTool.check(JLanguageTool.java:859) at org.languagetool.JLanguageTool.check(JLanguageTool.java:841) at org.languagetool.JLanguageTool.check(JLanguageTool.java:798) at org.languagetool.JLanguageTool.check(JLanguageTool.java:782) at taishan.languagetool.LanguageToolTest.main(LanguageToolTest.java:23) Caused by: java.io.IOException: Could not load file from classpath: '/en-token.bin' at org.languagetool.tools.Tools.getStream(Tools.java:264) at org.languagetool.chunking.EnglishChunker.<init>(EnglishChunker.java:62) ... 13 more
这个意思很明显,缺少文件。出错原因是自己编译的,缺少东西。去下载官方包就没有这个问题:https://internal1.languagetool.org/snapshots/