On Mon, 2005-01-17 at 10:25 -0800, Bill Janssen wrote:
> I'd like to package up a Lucene index with the Lucene class files and
> my own application classes into a single jar file, so that it forms a
> "double-clickable" single-file Java application that supports
> searching over the index.  However, I'm not sure how to read the index
> (create an IndexReader) if the files that form the index are packaged
> into the same jar file with the code.
> 
> If anyone could shed some light on how to do this, I'd appreciate it.


You'll have to implement org.apache.lucene.store.Directory to load the
index from the JAR file. Take a look at FSDirectory and RAMDirectory for
some more details.

Then you have either load the JAR file with java.util.jar.JarFile to get
to the files or you can use Classloader#getResourceAsStream to get to
them.




-- 
Miles Barr <[EMAIL PROTECTED]>
Runtime Collective Ltd.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to