简体   繁体   中英

Error using Stanford CoreNLP in command line

I am new to working with programs written in Java and am having a whole lot of trouble getting StanfordCoreNLP to do what it's supposed to do. I unzipped the program into its own directory, to which I added the XML file the program is supposed to process. The code I've been using to process the file in command line is:

java -cp stanford-corenlp-YYYY-MM-DD.jar:stanford-corenlp-YYYY-MM-DD-models.jar:xom.jar:joda-time.jar -Xmx3g edu.stanford.nlp.pipeline.StanfordCoreNLP [ -props ] -file .

The problem is that every time I try to run this I get the following error: "could not find or load main class edu.stanford.nlp.pipeline.StanfordCoreNLP." I'm just not sure how to deal with this error and would appreciate any help anyone can give. Thanks.

Are you using Windows? Have you checked the line below that reads

"For Windows, the colons (:) separating the jar files need to be semi-colons (;)."

Using the example, as is, will give you that error.

You have to install Java 1.8 to be able to run this command.

Running the following commands will install Java 1.8:

sudo add-apt-repository ppa:webupd8team/java

sudo apt-get update

sudo apt-get install oracle-java8-installer

This is taken directly from http://tecadmin.net/install-oracle-java-8-jdk-8-ubuntu-via-ppa/ ; for more information you can use that page.

Most probably, jar files in Stanford CoreNLP folder are named on versions such as Stanford-corenlp-3.4.1.jar in case of 2014-08-27 build. Either rename the file names as Stanford-corenlp-3.4.1.jar in command or rename the files in folder such as Stanford-corenlp-YYYY-MM-DD.jar.

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