Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / January 2006

Tip: Looking for answers? Try searching our database.

Lucene & Java

Thread view: 
Mongoose - 30 Jan 2006 17:08 GMT
Hello everyone,

I have a small but persisting problem.  I wrote .jsp code that
implements Lucene to do some very basic searching.  There were some
problems that I'm fairly certain were a result of the fact that I was
running the thing through Tomcat, so I tried translating the code to
straight java.

When the code was in .jsp form it compiled fine and ran (up to a point
where it crashed, but that's beside the point).  In java, it doesn't
seem to be able to pick up the location of a bunch of jar files -
these, to be exact:

import javax.servlet.http.*;
import org.apache.lucene.analysis.*;
import org.apache.lucene.document.*;
import org.apache.lucene.index.*;
import org.apache.lucene.search.*;
import org.apache.lucene.queryParser.*;
import org.apache.lucene.demo.*;
import org.apache.lucene.demo.html.Entities;

I don't understand why the .jsp would compile without errors but the
.java would not.  I'm exasperated, I've gone so far as to create my own
jar file containing the .class files that came with Lucene (e.g.
<lucene-directory>/org/apache/lucene/analysis, etc.), and adding that
to the CLASSPATH.  Any help would be appreciated here.  Thanks in
advance.
Paul Bilnoski - 30 Jan 2006 17:58 GMT
> Hello everyone,
>
[quoted text clipped - 24 lines]
> to the CLASSPATH.  Any help would be appreciated here.  Thanks in
> advance.

Have you checked to see if you have J2EE installed along with the JDK?
It contains the javax.servlet classes, and Tomcat uses J2EE from its
install to do its compilation.
Can you compile normal servlets in "straight java"?
--Paul
Mongoose - 30 Jan 2006 18:58 GMT
Ok, I figured it out.

I obviously didn't need the javax.servlet.http at all, I simply forgot
to remove it from the list of packages.

As far as the org.apache.lucene stuff was concerned, the IDE I was
using (JCreator) had a prerequisite of specifying the exact location of
certain .jar files - it didn't read them directly from CLASSPATH for
some odd reason.

Thanks for your reply, Paul.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.