smilli / py-corenlp

Python wrapper for Stanford CoreNLP
353 stars 75 forks source link

Error: Could not find or load main class edu.stanford.nlp.pipeline.StanfordCoreNLPServer #11

Open 85405115 opened 8 years ago

85405115 commented 8 years ago

hello, when i write below command,i get an error. command: java -mx4g -cp "*" edu.stanford.nlp.pipeline.StanfordCoreNLPServer [port] [timeout] Error: Error: Could not find or load main class edu.stanford.nlp.pipeline.StanfordCoreNLPServer

i am a beginner in python. but i need to use this module. please help me,what should i do?

ghost commented 8 years ago

If you're using -cp "*", you should be running this command in the directory where you installed StanfordCoreNLP (e.g. /home/stanford-corenlp-full-2015-12-09/).

Make sure that do one of the following

You can find more info here

PawarKishori commented 6 years ago

After running this java -mx3g edu.stanford.nlp.pipeline.StanfordCoreNLP -outputFormat json -file input.txt I am getting : Error: Could not find or load main class edu.stanford.nlp.pipeline.StanfordCoreNLP

I am getting above error(Though I have successfully set the path of CoreNLP in bashrc). I tried to run the command in this directory too: /home/stanford-corenlp-full-2015-12-09/ Still getting the same error.

Please help me.

leolle commented 6 years ago

@PawarKishori I get the same error, do you solve it?

Dabuk commented 6 years ago

@PawarKishori @leolle getting same error here, did you solve it?

Khallil commented 6 years ago

@PawarKishori It seems that using " -cp "*" " is the attended way to use the StanfordCoreNLP, use it in the StanfordCoreNLP directory

anoopsingh commented 6 years ago

java -mx3g -cp "*" edu.stanford.nlp.pipeline.StanfordCoreNLP, this works for me

SimengSun commented 6 years ago

I solved this problem by updating to java8

BioComSoftware commented 6 years ago

I know this is an old issue, but I wanted to mark it here for other's reference.

This issue can also happen if you have your stanford-corenlp-full-YYYY-MM-DD directory on a mounted file system. I was having this issue when attempting to start it in an NFS mount. I moved it locally, and it stopped.

mgupta1410 commented 5 years ago

If you have put the path to stanford-corenlp in CLASSPATH, you can remove classpath (-cp) option altogether. This works for me -

java -Xmx4g edu.stanford.nlp.pipeline.StanfordCoreNLP -file input.txt 

In your ~/.bashrc or ~/.zshrc you can put -

for file in `find /path/to/corenlp -name "*.jar"`;
do export CLASSPATH="$CLASSPATH:`realpath $file`"; done
stevennic commented 5 years ago

Double check also that you've installed the full CoreNLP and not just a language model. If you only have a jar that ends with "-models.jar", like stanford-english-corenlp-2018-10-05-models.jar, you're missing the rest of CoreNLP. I had made the mistake of downloading just a model from their download page, skipping past the big red "Download CoreNLP" button. :)

LiQiuAo commented 5 years ago

hello,I have similar problem,when I use Stanford POSTagger have error。Error: Could not find or load main class edu.stanford.nlp.tagger.maxent.MaxentTagger-model,I don't know why? windows-version: 10、java-version:1.8.0_65、Python:3.6.3、Stanford coreNLP 3.9.2 、Stanford postagger 3.9.2

heylukegit commented 4 years ago

Double check also that you've installed the full CoreNLP and not just a language model. If you only have a jar that ends with "-models.jar", like stanford-english-corenlp-2018-10-05-models.jar, you're missing the rest of CoreNLP. I had made the mistake of downloading just a model from their download page, skipping past the big red "Download CoreNLP" button. :)

May I ask where is the full CoreNLP? I can only download the version with a single "-model.jar".

stevennic commented 4 years ago

May I ask where is the full CoreNLP? I can only download the version with a single "-model.jar".

https://stanfordnlp.github.io/CoreNLP/download.html Click the big red "Download CoreNLP" button, not the links to the individual language models in the table beneath it.

imohammad12 commented 3 years ago

This works for me: java -mx3g -cp "path/to/stanford-corenlp-4.2.0/*" edu.stanford.nlp.pipeline.StanfordCoreNLP -outputFormat json -file input.txt

voiteshonok commented 1 year ago

That is because of absence StanfordCoreNLPServer class, which is an enrtypoint. Download CoreNLP 4.0.0 jar file from https://mvnrepository.com/artifact/edu.stanford.nlp/stanford-corenlp/4.0.0 and put in the same directory as model