py-corenlp icon indicating copy to clipboard operation
py-corenlp copied to clipboard

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

Open 85405115 opened this issue 8 years ago • 15 comments

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?

85405115 avatar Nov 02 '16 17:11 85405115

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 run the command inside the corenlp installation path
  • You change -cp "*" to the installation path (i.e. -cp "/home/stanford-corenlp-full-2015-12-09/")
  • You add the installation path to the CLASSPATH environment variable

You can find more info here

ghost avatar Nov 09 '16 18:11 ghost

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.

PawarKishori avatar Dec 25 '17 05:12 PawarKishori

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

leolle avatar Jan 26 '18 02:01 leolle

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

Dabuk avatar Mar 12 '18 07:03 Dabuk

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

Khallil avatar Mar 21 '18 05:03 Khallil

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

anoopsingh avatar May 01 '18 16:05 anoopsingh

I solved this problem by updating to java8

SimengSun avatar Jun 25 '18 02:06 SimengSun

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.

BioComSoftware avatar Jul 25 '18 12:07 BioComSoftware

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

mgupta1410 avatar Mar 26 '19 21:03 mgupta1410

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. :)

stevennic avatar Jul 06 '19 03:07 stevennic

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

LiQiuAo avatar Jul 09 '19 07:07 LiQiuAo

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".

heylukegit avatar Mar 24 '20 00:03 heylukegit

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.

stevennic avatar Mar 24 '20 01:03 stevennic

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

imohammad12 avatar Feb 15 '21 18:02 imohammad12

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

voiteshonok avatar Mar 08 '23 10:03 voiteshonok