Stanford-NLP:找不到主类错误 [英] Stanford-NLP: Could not find main class error

查看:184
本文介绍了Stanford-NLP:找不到主类错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题似乎已经回答了几次( https://stackoverflow.com/a/16208709/2771315 ),但由于某种原因,这些共享方法均无法正常工作.

This question seems to have been answered a few times (What does "Could not find or load main class" mean? and https://stackoverflow.com/a/16208709/2771315) but for some reason none of the shared methods are working.

到目前为止我所做的.

1)导航到终端中包含CoreNLP源文件的目录:~/Downloads/CoreNLP-master/src

1) Navigated to the directory containing the CoreNLP source files in terminal: ~/Downloads/CoreNLP-master/src

2)选择其中一个包作为测试用例,例如执行命令java -cp "*" -mx5g edu.stanford.nlp.sentiment.SentimentPipeline -file foo.txt(根据文档 http://nlp.stanford.edu/sentiment/code.html )

2) Selected one of the packages as a test case e.g. executed the command java -cp "*" -mx5g edu.stanford.nlp.sentiment.SentimentPipeline -file foo.txt (as per the docs, http://nlp.stanford.edu/sentiment/code.html)

我已经尝试通过更改类路径-cp条件并使用set CLASSPATH = $CLASSPATH=~/Downloads/CoreNLP-master/src进行设置来尝试上述方法,但似乎无法获得结果.有人知道我在做什么错吗?如果要冒昧地猜测一下,我认为类路径有问题,但是我不确定是什么问题.

I've tried variations of the above by altering the classpath -cp condition and setting it using set CLASSPATH = $CLASSPATH=~/Downloads/CoreNLP-master/src but can't seem to get a result. Does anyone know what I'm doing wrong? If I were to hazard a guess, I think that there is something wrong with the classpath but I'm not sure what.

推荐答案

classpath应该指向类,而不是源文件.如果您使用的是GitHub版本的代码,则可以将类路径设置为:

The classpath should point to the classes, not the source files. If you're using the GitHub version of the code, you can set the classpath to be:

-cp ~/Downloads/CoreNLP-master/classes:/path/to/corenlp/models.jar

您可以在以下位置找到CoreNLP模型的最新版本: http://nlp.stanford.edu/software/stanford-corenlp-models-current.jar (警告:> 200MB文件)

You can find the most recent version of the CoreNLP models at: http://nlp.stanford.edu/software/stanford-corenlp-models-current.jar (warning: >200MB file)

如果您有一个corenlp版本,则应将类路径设置为:

If you have one of the corenlp releases, you should set your classpath to:

-cp /path/to/corenlp.jar:/path/to/corenlp/models.jar

例如:

export CLASSPATH=stanford-corenlp-3.9.1.jar:stanford-corenlp-3.9.1-models.jar

corenlp jar和模型jar均应显示在压缩的代码版本中(例如,来自

Both the corenlp jar and the models jar should show up in the zipped release of the code (e.g., from http://nlp.stanford.edu/software/corenlp.shtml)

这篇关于Stanford-NLP:找不到主类错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆