Reputation: 4644
This question seems to have been answered a few times (What does "Could not find or load main class" mean? and https://stackoverflow.com/a/16208709/2771315) but for some reason none of the shared methods are working.
What I've done so far.
1) Navigated to the directory containing the CoreNLP source files in terminal: ~/Downloads/CoreNLP-master/src
2) Selected one of the packages as a test case e.g. executed the command java -cp "*" -mx5g edu.stanford.nlp.sentiment.SentimentPipeline -file foo.txt
(as per the docs, http://nlp.stanford.edu/sentiment/code.html)
I've tried variations of the above by altering the classpath -cp
condition and setting it using set CLASSPATH = $CLASSPATH=~/Downloads/CoreNLP-master/src
but can't seem to get a result. Does anyone know what I'm doing wrong? If I were to hazard a guess, I think that there is something wrong with the classpath but I'm not sure what.
Upvotes: 1
Views: 14372
Reputation: 5749
The classpath should point to the classes, not the source files. If you're using the GitHub version of the code, you can set the classpath to be:
-cp ~/Downloads/CoreNLP-master/classes:/path/to/corenlp/models.jar
You can find the most recent version of the CoreNLP models at: http://nlp.stanford.edu/software/stanford-corenlp-models-current.jar (warning: >200MB file)
If you have one of the corenlp releases, you should set your classpath to:
-cp /path/to/corenlp.jar:/path/to/corenlp/models.jar
For example:
export CLASSPATH=stanford-corenlp-3.9.1.jar:stanford-corenlp-3.9.1-models.jar
Both the corenlp jar and the models jar should show up in the zipped release of the code (e.g., from http://nlp.stanford.edu/software/corenlp.shtml)
Upvotes: 4
Reputation: 46
This worked perfectly fine for me.
java -cp "../*" -mx1g edu.stanford.nlp.sentiment.SentimentPipeline -file test.txt
Run this command while you are in the classes directory.
Upvotes: 2
Reputation: 2769
You are trying to run the program, instead of compiling it.
Upvotes: 0