Search code examples
javatomcatcygwinnutch

Nutch problem: java.lang.NoClassDefFoundError


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?


Solution

  • 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.