Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
85405115 opened this issue Nov 2, 2016 · 15 comments

Comments

@85405115
Copy link

85405115 commented Nov 2, 2016

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
Copy link

ghost commented Nov 9, 2016

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

@PawarKishori
Copy link

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
Copy link

leolle commented Jan 26, 2018

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

@Dabuk
Copy link

Dabuk commented Mar 12, 2018

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

@Khallil
Copy link

Khallil commented Mar 21, 2018

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

@anoopsingh
Copy link

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

@SimengSun
Copy link

SimengSun commented Jun 25, 2018

I solved this problem by updating to java8

@BioComSoftware
Copy link

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
Copy link

mgupta1410 commented Mar 26, 2019

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
Copy link

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
Copy link

LiQiuAo commented Jul 9, 2019

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
Copy link

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
Copy link

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
Copy link

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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests