Saul
Saul

Reputation: 29

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.

Upvotes: 2

Views: 2488

Answers (3)

Spy
Spy

Reputation: 13

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.

Upvotes: 0

Masoud
Masoud

Reputation: 259

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.

Upvotes: 3

bendecko
bendecko

Reputation: 2783

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.

Upvotes: 7

Related Questions