简体   繁体   中英

Stanford CoreNLP: Java can't find or load main class / java.ClassNotFoundException

To be honest, Java is a mystery for me. I just started a few days ago to learn Python, but now I need to use Stanford CoreNLP which needs Java (GOD!!!!!)

When I import Stanford CoreNlp in CMD, it always shows "Error: can't find or load main class... Reason: java.lang.ClassNotFoundException: ..." 就像图片所说的那样

But in fact, I have already made some changes in the environment (though they may not be correct). 环境路径

It may be an error of the setting of environement path, but I really don't know how to solve it...

You are facing with classpath issue

From your screenshot, current working directory is C:\Users(Name) which does not contains code of the SCNLP.

From Command Line Usage page , the minimal command to run Stanford CoreNLP from the command line is:

java -cp "*" edu.stanford.nlp.pipeline.StanfordCoreNLP -file input.txt

As you can see, you missed the -cp arg which does specify classpath.

You should cd to the code directory and use -cp "*" or pass the directory of the source code of Stanford CoreNLP as the value of -cp argument

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM