You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by DHIVYA M <dh...@yahoo.com> on 2009/10/26 07:36:50 UTC

Exception in thread main - error

Sir/Mam,
 
Am M.Dhivya, learning about apache lucene [Java].
 
I have installed JDK-6 update 4 and NetBeans-6.5.1
 
I downloaded the lucene-1.9-final.zip file and followed the steps given in docs to run the demo.
 
The extracted lucene-1.9-final folder from the downloaded zip file is in D:\ 
and the lucene-core-1.9-final.jar , lucene-demos-1.9-final.jar and src is in
 
D:\lucene-1.9-final\
 
As said i have set the classpath in environment variable PATH in System properties as,
D:\lucene-1.9-final\lucene-core-1.9-final.jar; D:\lucene-1.9-final\lucene-demos-1.9-final.jar;
 
Then in the command prompt i gave the command,
D:\lucene-1.9-final>java org.apache.lucene.demo.IndexFiles d:\lucene-1.9-final\src
 
But got the following error:

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)
        at java.lang.ClassLoader.loadClassInternal(Unknown Source)

Am  a beginner just started to learn about lucene by my own interest after knowing about its value. But now am scared as the things are totally blind for me. I went in through all the forums but couldnt find the solution. I couldnt find out where am missing or my procedure to run lucene demo is wrong. Kindly let me know a solution for which am struggling for past one week.
 
Thanks in advance
 M.Dhivya


      

Re: Exception in thread main - error

Posted by Anshum <an...@gmail.com>.
Hi Dhivya,
The complexity is not related to the version of lucene. Also, considering
you are now almost at the same plane with everyone else here, it'd be easier
for us to help you with figuring out and resolving the issues.
Now talking about your issue, its a  java classpath setting issue. Try
mentioning the cp @ the command line and running the program. also try
mentioning <complete-path-for-jar-directory>/* as the class path.
Its the JVM which can't figure out the class file. You might also want to
extract the class files [from the jar] and check if the jar is ok and
contains the class file.

--
Anshum Gupta
Naukri Labs!
http://ai-cafe.blogspot.com

The facts expressed here belong to everybody, the opinions to me. The
distinction is yours to draw............


On Mon, Oct 26, 2009 at 12:43 PM, DHIVYA M <dh...@yahoo.com>wrote:

> Hi anshum,
>
> But am getting the same error for lucene 2.4 even. My actual intention was
> to take up the earlier version so that it might be easier with less
> complexity.
>
> --- On Mon, 10/26/09, Anshum <an...@gmail.com> wrote:
>
>
> From: Anshum <an...@gmail.com>
> Subject: Re: Exception in thread main - error
> To: java-user@lucene.apache.org
> Date: Monday, October 26, 2009, 6:45 AM
>
>
> Hi Dhivya,
> It'd be a wise step to upgrade to a more recent lucene release. 2.9 (though
> that does not mean that the issue you encountered was because of that)
> would
> be ideal I'd say, but could also try 2.4.
>
>
> --
> Anshum Gupta
> Naukri Labs!
> http://ai-cafe.blogspot.com
>
> The facts expressed here belong to everybody, the opinions to me. The
> distinction is yours to draw............
>
>
> On Mon, Oct 26, 2009 at 12:06 PM, DHIVYA M <dhivyakrishnan87@yahoo.com
> >wrote:
>
> > Sir/Mam,
> >
> > Am M.Dhivya, learning about apache lucene [Java].
> >
> > I have installed JDK-6 update 4 and NetBeans-6.5.1
> >
> > I downloaded the lucene-1.9-final.zip file and followed the steps given
> in
> > docs to run the demo.
> >
> > The extracted lucene-1.9-final folder from the downloaded zip file is in
> > D:\
> > and the lucene-core-1.9-final.jar , lucene-demos-1.9-final.jar and src is
> > in
> >
> > D:\lucene-1.9-final\
> >
> > As said i have set the classpath in environment variable PATH in System
> > properties as,
> > D:\lucene-1.9-final\lucene-core-1.9-final.jar;
> > D:\lucene-1.9-final\lucene-demos-1.9-final.jar;
> >
> > Then in the command prompt i gave the command,
> > D:\lucene-1.9-final>java org.apache.lucene.demo.IndexFiles
> > d:\lucene-1.9-final\src
> >
> > But got the following error:
> >
> > 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)
> >         at java.lang.ClassLoader.loadClassInternal(Unknown Source)
> >
> > Am  a beginner just started to learn about lucene by my own interest
> after
> > knowing about its value. But now am scared as the things are totally
> blind
> > for me. I went in through all the forums but couldnt find the solution. I
> > couldnt find out where am missing or my procedure to run lucene demo is
> > wrong. Kindly let me know a solution for which am struggling for past one
> > week.
> >
> > Thanks in advance
> >  M.Dhivya
> >
> >
> >
>
>
>
>
>

Re: Exception in thread main - error

Posted by DHIVYA M <dh...@yahoo.com>.
Hi anshum,
 
But am getting the same error for lucene 2.4 even. My actual intention was to take up the earlier version so that it might be easier with less complexity.

--- On Mon, 10/26/09, Anshum <an...@gmail.com> wrote:


From: Anshum <an...@gmail.com>
Subject: Re: Exception in thread main - error
To: java-user@lucene.apache.org
Date: Monday, October 26, 2009, 6:45 AM


Hi Dhivya,
It'd be a wise step to upgrade to a more recent lucene release. 2.9 (though
that does not mean that the issue you encountered was because of that) would
be ideal I'd say, but could also try 2.4.


--
Anshum Gupta
Naukri Labs!
http://ai-cafe.blogspot.com

The facts expressed here belong to everybody, the opinions to me. The
distinction is yours to draw............


On Mon, Oct 26, 2009 at 12:06 PM, DHIVYA M <dh...@yahoo.com>wrote:

> Sir/Mam,
>
> Am M.Dhivya, learning about apache lucene [Java].
>
> I have installed JDK-6 update 4 and NetBeans-6.5.1
>
> I downloaded the lucene-1.9-final.zip file and followed the steps given in
> docs to run the demo.
>
> The extracted lucene-1.9-final folder from the downloaded zip file is in
> D:\
> and the lucene-core-1.9-final.jar , lucene-demos-1.9-final.jar and src is
> in
>
> D:\lucene-1.9-final\
>
> As said i have set the classpath in environment variable PATH in System
> properties as,
> D:\lucene-1.9-final\lucene-core-1.9-final.jar;
> D:\lucene-1.9-final\lucene-demos-1.9-final.jar;
>
> Then in the command prompt i gave the command,
> D:\lucene-1.9-final>java org.apache.lucene.demo.IndexFiles
> d:\lucene-1.9-final\src
>
> But got the following error:
>
> 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)
>         at java.lang.ClassLoader.loadClassInternal(Unknown Source)
>
> Am  a beginner just started to learn about lucene by my own interest after
> knowing about its value. But now am scared as the things are totally blind
> for me. I went in through all the forums but couldnt find the solution. I
> couldnt find out where am missing or my procedure to run lucene demo is
> wrong. Kindly let me know a solution for which am struggling for past one
> week.
>
> Thanks in advance
>  M.Dhivya
>
>
>



      

Re: Exception in thread main - error

Posted by Anshum <an...@gmail.com>.
Hi Dhivya,
It'd be a wise step to upgrade to a more recent lucene release. 2.9 (though
that does not mean that the issue you encountered was because of that) would
be ideal I'd say, but could also try 2.4.


--
Anshum Gupta
Naukri Labs!
http://ai-cafe.blogspot.com

The facts expressed here belong to everybody, the opinions to me. The
distinction is yours to draw............


On Mon, Oct 26, 2009 at 12:06 PM, DHIVYA M <dh...@yahoo.com>wrote:

> Sir/Mam,
>
> Am M.Dhivya, learning about apache lucene [Java].
>
> I have installed JDK-6 update 4 and NetBeans-6.5.1
>
> I downloaded the lucene-1.9-final.zip file and followed the steps given in
> docs to run the demo.
>
> The extracted lucene-1.9-final folder from the downloaded zip file is in
> D:\
> and the lucene-core-1.9-final.jar , lucene-demos-1.9-final.jar and src is
> in
>
> D:\lucene-1.9-final\
>
> As said i have set the classpath in environment variable PATH in System
> properties as,
> D:\lucene-1.9-final\lucene-core-1.9-final.jar;
> D:\lucene-1.9-final\lucene-demos-1.9-final.jar;
>
> Then in the command prompt i gave the command,
> D:\lucene-1.9-final>java org.apache.lucene.demo.IndexFiles
> d:\lucene-1.9-final\src
>
> But got the following error:
>
> 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)
>         at java.lang.ClassLoader.loadClassInternal(Unknown Source)
>
> Am  a beginner just started to learn about lucene by my own interest after
> knowing about its value. But now am scared as the things are totally blind
> for me. I went in through all the forums but couldnt find the solution. I
> couldnt find out where am missing or my procedure to run lucene demo is
> wrong. Kindly let me know a solution for which am struggling for past one
> week.
>
> Thanks in advance
>  M.Dhivya
>
>
>

Re: Exception in thread main - error

Posted by DHIVYA M <dh...@yahoo.com>.
Thanx for the info. Now i understood what exactly the classpath is.

--- On Mon, 10/26/09, Chris Hostetter <ho...@fucit.org> wrote:


From: Chris Hostetter <ho...@fucit.org>
Subject: Re: Exception in thread main - error
To: "java user" <ja...@lucene.apache.org>
Date: Monday, October 26, 2009, 6:39 PM



: As said i have set the classpath in environment variable PATH in System properties as,
: D:\lucene-1.9-final\lucene-core-1.9-final.jar; D:\lucene-1.9-final\lucene-demos-1.9-final.jar;

"PATH" is not "the classpath in environment" for any JVM that i know of, 
reading this document may be helpful...

http://java.sun.com/j2se/1.5.0/docs/tooldocs/windows/classpath.html


-Hoss



---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


      

Re: Exception in thread main - error

Posted by Chris Hostetter <ho...@fucit.org>.
: As said i have�set the classpath in environment variable PATH in System properties as,
: D:\lucene-1.9-final\lucene-core-1.9-final.jar; D:\lucene-1.9-final\lucene-demos-1.9-final.jar;

"PATH" is not "the classpath in environment" for any JVM that i know of, 
reading this document may be helpful...

http://java.sun.com/j2se/1.5.0/docs/tooldocs/windows/classpath.html


-Hoss