stanfordnlp / CoreNLP

CoreNLP: A Java suite of core NLP tools for tokenization, sentence segmentation, NER, parsing, coreference, sentiment analysis, etc.
http://stanfordnlp.github.io/CoreNLP/
GNU General Public License v3.0
9.72k stars 2.7k forks source link

Could not load main class Error #741

Closed humehta closed 6 years ago

humehta commented 6 years ago

Command: java -Xmx5g -cp C:\Users\harsh\CoreNLP\stanford-corenlp-full-2018-02-27\stanford-corenlp-3.9.1.jar:stanford-english-corenlp-models-current.jar:* edu.stanford.nlp.pipeline.StanfordCoreNLP -props C:\Users\harsh\CoreNLP\src\edu\stanford\nlp\coref\properties\deterministic-english.properties -file C:\Users\harsh\PycharmProjects\untitled3\to_openIE.txt

Get the following error: Error: Could not find or load main class edu.stanford.nlp.pipeline.StanfordCoreNLP

Any help?

manning commented 6 years ago

This clearly means wrong classpath. Here, if you're on Windows, you need a semicolon between items on the classpath (-cp flag) not colons. I'm pretty sure this is mentioned in a couple of places early in the CoreNLP docs. But if there is another page to add this on, you can let us know.

humehta commented 6 years ago

Thank you for the response Christopher. Can you let me know the places where it is mentioned I could not find any.

humehta commented 6 years ago

@manning Got the following error when running the below command:

Command:

java -Xmx5g -cp stanford-corenlp-3.9.1.jar;stanford-corenlp-models-current.jar;* edu.stanford.nlp.pipeline.StanfordCoreNLP -annotators tokenize,ssplit,pos,lemma,ner,parse,mention,coref -coref.algorithm neural -file C:\Users\harsh\PycharmProjects\untitled3\dummy.txt

Error:

Adding annotator tokenize No tokenizer type provided. Defaulting to PTBTokenizer. Adding annotator ssplit Adding annotator pos Loading POS tagger from edu/stanford/nlp/models/pos-tagger/english-left3words/english-left3words-distsim.tagger ... done [1.2 sec]. Adding annotator lemma Adding annotator ner Loading classifier from edu/stanford/nlp/models/ner/english.all.3class.distsim.crf.ser.gz ... done [1.7 sec]. Loading classifier from edu/stanford/nlp/models/ner/english.muc.7class.distsim.crf.ser.gz ... done [0.5 sec]. Loading classifier from edu/stanford/nlp/models/ner/english.conll.4class.distsim.crf.ser.gz ... done [1.9 sec]. Exception in thread "main" edu.stanford.nlp.io.RuntimeIOException: Couldn't read TokensRegexNER from edu/stanford/nlp/models/kbp/regexner_caseless.tab at edu.stanford.nlp.pipeline.TokensRegexNERAnnotator.readEntries(TokensRegexNERAnnotator.java:593) at edu.stanford.nlp.pipeline.TokensRegexNERAnnotator.(TokensRegexNERAnnotator.java:293) at edu.stanford.nlp.pipeline.NERCombinerAnnotator.setUpFineGrainedNER(NERCombinerAnnotator.java:209) at edu.stanford.nlp.pipeline.NERCombinerAnnotator.(NERCombinerAnnotator.java:152) at edu.stanford.nlp.pipeline.AnnotatorImplementations.ner(AnnotatorImplementations.java:68) at edu.stanford.nlp.pipeline.StanfordCoreNLP.lambda$getNamedAnnotators$44(StanfordCoreNLP.java:546) at edu.stanford.nlp.pipeline.StanfordCoreNLP.lambda$null$69(StanfordCoreNLP.java:625) at edu.stanford.nlp.util.Lazy$3.compute(Lazy.java:126) at edu.stanford.nlp.util.Lazy.get(Lazy.java:31) at edu.stanford.nlp.pipeline.AnnotatorPool.get(AnnotatorPool.java:149) at edu.stanford.nlp.pipeline.StanfordCoreNLP.construct(StanfordCoreNLP.java:495) at edu.stanford.nlp.pipeline.StanfordCoreNLP.(StanfordCoreNLP.java:201) at edu.stanford.nlp.pipeline.StanfordCoreNLP.(StanfordCoreNLP.java:194) at edu.stanford.nlp.pipeline.StanfordCoreNLP.(StanfordCoreNLP.java:181) at edu.stanford.nlp.pipeline.StanfordCoreNLP.main(StanfordCoreNLP.java:1426) Caused by: java.io.IOException: Unable to open "edu/stanford/nlp/models/kbp/regexner_caseless.tab" as class path, filename or URL at edu.stanford.nlp.io.IOUtils.getInputStreamFromURLOrClasspathOrFileSystem(IOUtils.java:480) at edu.stanford.nlp.io.IOUtils.readerFromString(IOUtils.java:617) at edu.stanford.nlp.pipeline.TokensRegexNERAnnotator.readEntries(TokensRegexNERAnnotator.java:590) ... 14 more

humehta commented 6 years ago

I figured it out thanks anyways @manning

saipavanmeruga commented 5 years ago

@humehta can you let me know how to solve this? hope you were training your own ner model and got this error....