Nutch 问题:java.lang.NoClassDefFoundError
我正在尝试在我的 Windows 计算机上运行 Nutch。我安装了 Nutch、Java、Tomcat 和 Cygwin。当我尝试在 Cygwin 中运行抓取命令时,出现以下错误:
java.lang.NoClassDefFoundError: org/apache/nutch/crawl/Crawl
Caused by: java.lang.ClassNotFoundException: org.apache.nutch.crawl.Crawl
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Could not find the main class: org.apache.nutch.crawl.Crawl. Program will exit.
Exception in thread "main"
我的 Java 有点生疏,但这似乎告诉我 Crawl
类不存在。如果是这种情况,我该如何找到它并确保我的系统知道它的存在?
I'm trying to run Nutch on my Windows machine. I have Nutch, Java, Tomcat, and Cygwin installed. When I try to run the crawl command in Cygwin, I get the following error:
java.lang.NoClassDefFoundError: org/apache/nutch/crawl/Crawl
Caused by: java.lang.ClassNotFoundException: org.apache.nutch.crawl.Crawl
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Could not find the main class: org.apache.nutch.crawl.Crawl. Program will exit.
Exception in thread "main"
My Java is a bit rusty, but this seems to be telling me that the Crawl
class doesn't exist. If this is the case, how do I go about finding it -- and making sure my system is aware of its existence?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
您必须将 nutch jar 添加到类路径中。 查看这里如何
看来nutch发行版并没有用罐子运送。您必须使用 ant
build.xml
自行构建它。在nutch目录中输入ant jar
(如果你安装了ant),它将生成jar。You must add the nutch jar to your classpath. See here how
It appears that the nutch distribution does not ship with a jar. You have to build it yourself using the ant
build.xml
. Typeant jar
in the nutch directory (if you have ant installed), and it will make the jar.对于nutch-1.4,
从nutch 目录中运行,然后将生成的nutch-*.job 文件从build 子目录移动到src 子目录中,这对我来说是成功的。
for nutch-1.4, running
from within the nutch directory, and then moving the resulting nutch-*.job file from the build subdirectory into the src subdirectory, did the trick for me.
JVM 告诉您它找不到
Crawl
类。这很可能是因为传递给 java 命令的命令行参数没有指定正确的类路径。 (类路径是搜索类时使用的搜索路径,通常在命令行或使用 CLASSPATH 环境变量设置。)The JVM is telling you that it cannot find the
Crawl
class. This is most likely because the command line arguments being passed to thejava
command are not specifying the correct classpath. (The classpath is a search path used when searching for classes, and is typically set on the command line or using the CLASSPATH environment variable.)你用的是什么版本?因为某些版本包含 .jar,但最近的版本(例如 1.2)不包含 .jar,并且在某处有警告告诉您必须自己构建它。
What version are you using though ? Because some version include the .jar, however the recent ones like 1.2 does not and there is a warning somewhere telling you that you must build it yourself.
我不知道它有多旧,我在nutch 1.4上遇到了同样的问题,我的解决方案是:
在bin中打开nutch
并将
99% Crawl 应该输出熟悉的内容。
I don't know how Old it is, I had the same problems with nutch 1.4, well my solution:
open nutch in bin
and
99% Crawl should output something familiar.