lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Rogers <paul.roge...@gmail.com>
Subject Re: Problem running demo's - java classes not found
Date Thu, 04 Mar 2010 20:19:28 GMT
Erick

What a star!! Hadn't thought of that.  Assumed (always a mistake) that the
classpath only pointed to the directory.  Using the following command:

java -cp
/home/paul/bin/lucene-3.0.0/lucene-core-3.0.0.jar:/home/paul/bin/lucene-3.0.0/lucene-demos-3.0.0.jar
org.apache.lucene.demo.IndexFiles docs

fixed the problem.  docs directory is now indexed!!

Many thanks for all your help.

Regards

Paul

On 4 March 2010 19:52, Erick Erickson <erickerickson@gmail.com> wrote:

> Doesn't your classpath need the full path to the jar, not just
> the containing directory?
>
> On Thu, Mar 4, 2010 at 1:22 PM, Paul Rogers <paul.rogers6@gmail.com>
> wrote:
>
> > Dear All
> >
> > Further to my previous email I notice I made a mistake with the second
> > example.  When I entered the second command it actually read:
> >
> > java -cp org.apache.lucene.demo.IndexFiles docs
> >
> > This is what gave the strange error about the docs Class was.  If I issue
> > the correct command:
> >
> > java org.apache.lucene.demo.IndexFiles docs
> >
> > I get the  same error as the first example.  My apologies for the
> typo/mix
> > up.
> >
> >
> > Regards
> >
> >
> >
> > Paul
> >
> > ---------- Forwarded message ----------
> > From: Paul Rogers <paul.rogers6@gmail.com>
> > Date: 4 March 2010 17:49
> > Subject: Problem running demo's - java classes not found
> > To: java-user@lucene.apache.org
> >
> >
> > Dear  All
> >
> > Hope someone can help.  I'm trying to run the demo's that came with
> Lucene
> > (3.0.0).  I extracted the tar.gz to a directory
> /home/paul/bin/lucene-3.0.0
> > and changed into the directory.  The contents of the directory are as
> > follows:
> >
> > total 2288
> > -rw-r--r--  1 paul paul    3759 2009-11-16 14:00 BUILD.txt
> > -rw-r--r--  1 paul paul    9931 2009-11-22 14:47 build.xml
> > -rw-r--r--  1 paul paul  183614 2009-11-22 14:03 CHANGES.txt
> > drwxr-xr-x 25 paul paul    4096 2010-02-13 20:00 contrib
> > drwxr-xr-x  7 paul paul    4096 2009-11-22 14:47 docs
> > -rw-r--r--  1 paul paul    1616 2009-11-17 20:09
> JRE_VERSION_MIGRATION.txt
> > drwxr-xr-x  2 paul paul    4096 2010-02-13 20:00 lib
> > -rw-r--r--  1 paul paul   12637 2009-11-16 14:00 LICENSE.txt
> > -rw-r--r--  1 paul paul 1021623 2009-11-22 14:44 lucene-core-3.0.0.jar
> > -rw-r--r--  1 paul paul   57087 2009-11-22 14:47 lucene-demos-3.0.0.jar
> > -rw-r--r--  1 paul paul  995413 2009-11-22 14:47 luceneweb.war
> > -rw-r--r--  1 paul paul    1319 2009-11-16 14:00 NOTICE.txt
> > -rw-r--r--  1 paul paul    1157 2009-11-16 14:00 README.txt
> > drwxr-xr-x  4 paul paul    4096 2010-02-13 20:00 src
> >
> > I then run the following command, with the following results:
> >
> > java -cp /home/paul/bin/lucene-3.0.0/ 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:200)
> >    at java.security.AccessController.doPrivileged(Native Method)
> >    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
> >    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
> >    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
> >    at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
> >    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
> > Could not find the main class: org.apache.lucene.demo.IndexFiles.
>  Program
> > will exit.
> >
> > I also tried:
> >
> >
> > CLASSPATH=/home/paul/bin/lucene-3.0.0/
> >
> > echo $CLASSPATH
> > /home/paul/bin/lucene-3.0.0/
> >
> > java org.apache.lucene.demo.IndexFiles docs
> >
> > This gives the following error:
> >
> > Exception in thread "main" java.lang.NoClassDefFoundError: docs
> > Caused by: java.lang.ClassNotFoundException: docs
> >    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
> >    at java.security.AccessController.doPrivileged(Native Method)
> >    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
> >    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
> >    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
> >    at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
> >    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
> > Could not find the main class: docs.  Program will exit.
> >
> > I've searched the mailing lists and the problem generally seems to be
> that
> > the class path is not set.  Is this the issue here.  If so what am I
> doing
> > wrong?  Why does the second example say the class docs is missing when
> this
> > is the directory to index?  Does this all mean the classpath is not set
> in
> > the first example but is in the second?
> >
> > Alternatively any suggestions as to what the problem is?  If it's a java
> > problem and is in the wrong forum, my apologies.  If some one'll point me
> > in
> > the right direction I'd be grateful.
> >
> > Many thanks in advance.
> >
> > Regards
> >
> > Paul
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message