0

I have downloaded the latest version for NER from this link. Then after extracting it, I have run this command.

java -cp stanford-ner.jar edu.stanford.nlp.ie.crf.CRFClassifier -prop austen.prop

This is not working and getting following exception.

CRFClassifier invoked on Mon Jul 25 06:56:22 EDT 2016 with arguments:
   -prop austen.prop
Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
    at edu.stanford.nlp.io.IOUtils.<clinit>(IOUtils.java:42)
    at edu.stanford.nlp.util.StringUtils.argsToProperties(StringUtils.java:942)
    at edu.stanford.nlp.util.StringUtils.argsToProperties(StringUtils.java:891)
    at edu.stanford.nlp.ie.crf.CRFClassifier.main(CRFClassifier.java:2994)
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 4 more

In the folder, stanford-ner-2015-12-09 there is another folder lib, it already contains slf4j libraries but still it is not executing above command. I just downloaded and then extracted files and run that command to make a model but this exception is coming. I will be thankful to you if you can help me.

Hammad Hassan
  • 1,192
  • 17
  • 29
  • But libs exist and then still it is giving same error. – Hammad Hassan Jul 25 '16 at 11:06
  • where are u specifying stanford-ner-2015-12-09\lib in the classpath? – sidgate Jul 25 '16 at 11:07
  • You are missing libraries in the classpath (specifically, [SLF4J](http://www.slf4j.org/), but if you include that there will likely be more missing libraries). Just the fact that you have a "libs" directory doesn't mean it's automatically included in the classpath. – Jesper Jul 25 '16 at 11:07
  • @Tunaki It was a different question. It was not duplicate. Kindly observe the answer and comments for your clarification. – Hammad Hassan Jul 25 '16 at 13:15
  • @HammadHassan I disagree, the answer is the same: the classpath was not correctly set and this is what the linked answer says. – Tunaki Jul 25 '16 at 13:16
  • @Tunaki Everything was set in my case. Just COMMAND was incorrect. – Hammad Hassan Jul 25 '16 at 13:18
  • @HammadHassan Well the command was not posted in the question. But you can also refer to http://stackoverflow.com/questions/219585/setting-multiple-jars-in-java-classpath for the command. – Tunaki Jul 25 '16 at 13:23
  • @Tunaki Have a look on 3rd line of my question. Command is already there. java -cp stanford-ner.jar edu.stanford.nlp.ie.crf.CRFClassifier -prop austen.prop I am really really shocked why you can not see my command. Really shocking. – Hammad Hassan Jul 25 '16 at 14:02

1 Answers1

5

Can you try

UNIX:

java -cp stanford-ner.jar:lib/*:. edu.stanford.nlp.ie.crf.CRFClassifier -prop austen.prop

Windows:

java -cp stanford-ner.jar;lib/*;. edu.stanford.nlp.ie.crf.CRFClassifier -prop austen.prop
Dev
  • 6,628
  • 2
  • 25
  • 34