2

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.

7
  • 1
    The command is correct are you sure you're running it from the correct directory? That error seems as if you're either in the wrong directory or you've got a corrupted zip file. Commented Dec 5, 2012 at 5:43
  • If you find the reason you're going wrong please post it below so others can find it to. Commented Dec 5, 2012 at 5:48
  • In command line I'm running it from the directory I put it in when i downloaded it. How would I know if I had a corrupted zip file? Commented Dec 5, 2012 at 5:48
  • 1
    Are you sure it's called stanford-corenlp-YYYY-MM-DD.jar? I would think they'd give the year-month-date of the build. Commented Dec 5, 2012 at 8:14
  • 1
    @hd1 LOL Yeah.. I'm assuming you replaced YYYY-MM-DD with the year month and date of your build. There's no real way to know if the ZIP file is corrupted. The only way is to re-download and see if it was messed up in the first place. Commented Dec 5, 2012 at 8:45

3 Answers 3

7

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.

Sign up to request clarification or add additional context in comments.

Comments

3

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.

1 Comment

This answer was spot on for me.
0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.