错误 - " java.lang.NoClassDefFoundError"在创建StanfordCoreNLP对象时

时间:2015-03-23 19:27:01

标签: java eclipse maven nlp stanford-nlp

以下是我创建StanfordCoreNLP对象的代码。我正在使用eclipse并从中下载了stanford-corenlp-3.2.0.jar http://www.java2s.com/Code/Jar/s/Downloadstanfordcorenlp320jar.htm

我收到以下错误消息:

Exception in thread "main" java.lang.NoClassDefFoundError: nu/xom/Node
    at MAIN.main(MAIN.java:12)
Caused by: java.lang.ClassNotFoundException: nu.xom.Node
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 1 more

主要课程:

import java.util.Properties;
import edu.stanford.nlp.pipeline.StanfordCoreNLP;
public class MAIN {
    public static void main(String[] args) {
    // TODO Auto-generated method stub
        Properties props = new Properties();
        props.put("annotators", "tokenize, ssplit, pos, lemma, ner");
        StanfordCoreNLP pipeline = new StanfordCoreNLP(props,true);
    }
}

1 个答案:

答案 0 :(得分:1)

您似乎错过了类路径中的xom.jar。下载并添加它。