I downloaded the lucene jars and then added them to the CLASSPATH variable via my .bash_profile, the paths to the jars display correctly in the terminal.
export CLASSPATH=/Users/dk/lucene-3.4.0/lucene-core-3.4.0.jar
export CLASSPATH=$CLASSPATH:/Users/dk/lucene-3.4.0/contrib/demo/lucene-demo-3.4.0.jar
echo $CLASSPATH
/Users/dk/lucene-3.4.0/lucene-core-3.4.0.jar:/Users/dk/lucene-3.4.0/contrib/demo/lucene-demo-3.4.0.jar
However, java still complains to me when I try to run the demo:
java org.apache.lucene.demo.IndexFiles -docs .
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/lucene/demo/IndexFiles
Caused by: java.lang.ClassNotFoundException: org.apache.lucene.demo.IndexFiles
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
......
I was able to follow this exact procedure to get the lucene demo working on an ubuntu machine, now I just want it to be able to run on my mac. It seems there are similar questions floating around stackoverflow but none of them seem to answer this question.
Dave Newton :
Are you sure you have your paths right? It works fine for me.\n\n.../lucene-3.4.0/tmp $ ls\nlucene-core-3.4.0.jar lucene-demo-3.4.0.jar\n.../lucene-3.4.0/tmp $ export CLASSPATH=./lucene-core-3.4.0.jar:./lucene-demo-3.4.0.jar\n.../lucene-3.4.0/tmp $ echo $CLASSPATH\n./lucene-core-3.4.0.jar:./lucene-demo-3.4.0.jar\n.../lucene-3.4.0/tmp $ java org.apache.lucene.demo.IndexFiles -docs .\nIndexing to directory 'index'...\nadding ./lucene-core-3.4.0.jar\nadding ./lucene-demo-3.4.0.jar\n1485 total milliseconds\n.../lucene-3.4.0/tmp $\n",
2011-10-25T04:56:48