Nutch 问题:java.lang.NoClassDefFoundError

发布于 2024-10-05 09:40:21 字数 835 浏览 3 评论 0原文

我正在尝试在我的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

人生戏 2024-10-12 09:40:21

您必须将 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. Type ant jar in the nutch directory (if you have ant installed), and it will make the jar.

眼前雾蒙蒙 2024-10-12 09:40:21

对于nutch-1.4,

ant job

从nutch 目录中运行,然后将生成的nutch-*.job 文件从build 子目录移动到src 子目录中,这对我来说是成功的。

for nutch-1.4, running

ant job

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.

听你说爱我 2024-10-12 09:40:21

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 the java 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.)

源来凯始玺欢你 2024-10-12 09:40:21

你用的是什么版本?因为某些版本包含 .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.

被你宠の有点坏 2024-10-12 09:40:21

我不知道它有多旧,我在nutch 1.4上遇到了同样的问题,我的解决方案是:

  • 将NUTCH_JAVA_HOME设置为java主文件夹
  • 设置NUTCH_HOME
  • 设置JAVA_HOME
  • 设置CLASSPATH以包含所有必需的jar文件

在bin中打开nutch
并将

  1. cygwin 手动更改为 true
  2. 从 lib 文件夹中删除本机文件夹

99% Crawl 应该输出熟悉的内容。

I don't know how Old it is, I had the same problems with nutch 1.4, well my solution:

  • set NUTCH_JAVA_HOME to the java home folder
  • set NUTCH_HOME
  • set JAVA_HOME
  • set CLASSPATH to include all required jar files

open nutch in bin
and

  1. change cygwin manually to true
  2. DELETE the native folder from the lib folder

99% Crawl should output something familiar.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文