Samyak Choudhary
Samyak Choudhary

Reputation: 21

Error - "java.lang.NoClassDefFoundError" in creating StanfordCoreNLP object

following is my code to create StanfordCoreNLP object. I am using eclipse and have downloaded the stanford-corenlp-3.2.0.jar from http://www.java2s.com/Code/Jar/s/Downloadstanfordcorenlp320jar.htm

I am getting the following error message:

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

main class:

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);
    }
}

Upvotes: 1

Views: 693

Answers (1)

Jens
Jens

Reputation: 69440

Looks like you miss the xom.jar in youe classpath. Download and add it.

Upvotes: 1

Related Questions