lucene-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steven A Rowe <sar...@syr.edu>
Subject RE: ClassNotFoundException
Date Thu, 18 Nov 2010 17:42:02 GMT
Hi Lewis,

You should use the java-user@l.a.o list rather than general@l.a.o, which is not intended to
be used to answer end-user questions.  The java-user mailing list has way more subscribers,
so you'll get better/faster responses there, anyway.

Most likely you don't have the demo jar on the classpath visible to your java process.  

Are you using the CLASSPATH environment variable?  How do you set it?  In Cygwin (assuming
Bash shell), you need to "export CLASSPATH" to make it visible to child processes (children
of the Bash shell, e.g. the JRE).  (Cygwin auto-exports all Windows-defined environment variables,
so if you used the interface at "My Computer|Properties|Advanced System Settings|Environment
Variables" to set them, then exporting them under Cygwin is not necessary.)

You could also try providing the classpath as a cmdline param to the java executable, e.g.
"-classpath /path/to/lucene-core-3.0.1.jar:/path/to/lucene-demos-3.0.1.jar".

Steve

> -----Original Message-----
> From: McGibbney, Lewis John [mailto:Lewis.McGibbney@gcu.ac.uk]
> Sent: Thursday, November 18, 2010 9:53 AM
> To: general@lucene.apache.org
> Subject: ClassNotFoundException
> 
> Hello List,
> 
> Currently using lucene-3.0.1 on Windows XP with Cygwin to execute commands
> 
> Trying to index files in my directory and I am receiving the following
> 
> LMCGIB10@BNE001840 /cygdrive/c/Downloads/Apache/lucene-3.0.1/lucene-3.0.1
> $ java org.apache.lucene.demo.IndexFiles C:/Downloads/Apache/lucene-3.0.1/
> lucene-3.0.1/src
> Exception in thread "main" java.lang.NoClassDefFoundError:
> org/apache/lucene/dem
> o/IndexFiles
> Caused by: java.lang.ClassNotFoundException:
> org.apache.lucene.demo.IndexFiles
>         at java.net.URLClassLoader$1.run(Unknown Source)
>         at java.security.AccessController.doPrivileged(Native Method)
>         at java.net.URLClassLoader.findClass(Unknown Source)
>         at java.lang.ClassLoader.loadClass(Unknown Source)
>         at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
>         at java.lang.ClassLoader.loadClass(Unknown Source)
> Could not find the main class: org.apache.lucene.demo.IndexFiles  Program
> will exit.
> 
> I have both lucene-core-3.0.1 and lucene-demos-3.0.1 in my classpath,
> although I also have a Nutch/lib variable which includes lucene-core-3.0.1
> already set in my environment as I have been using this project as well...
> is this the problem? If not can someone please suggest what is going
> wrong.
> 
> Thank you
> 
> Lewis
> 
> Glasgow Caledonian University is a registered Scottish charity, number
> SC021474
> 
> Winner: Times Higher Education's Widening Participation Initiative of the
> Year 2009 and Herald Society's Education Initiative of the Year 2009
> http://www.gcu.ac.uk/newsevents/news/bycategory/theuniversity/1/name,6219,
> en.html
Mime
View raw message