Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I use Lucene in cmd

Tags:

cmd

lucene

I am trying to use lucene on the Windows' command line as given in this link.

I have created the CLASSPATH variable for all four mentioned .jar files, but after that, when I run the command:

java org.apache.lucene.demo.IndexFiles -docs C:/lucene/src

it returns the following error:

could not find or load main class org.apache.lucene.demo.IndexFiles

I dont know what's wrong with it... Can anybody help me out? I am a student and just a beginner. Thanks

like image 652
Tahir Shahzad Avatar asked Apr 20 '13 17:04

Tahir Shahzad


1 Answers

I ran into a similar issue, you need to include the CLASSPATHs in your command (if its not in environment vars). So it should be:

java -classpath C:\lucene\lucene-5.1.0\core\lucene-core-5.1.0.jar;C:\lucene\lucene-5.1.0\queryparser\lucene-queryparser-5.1.0.jar;C:\lucene\lucene-5.1.0\analysis\common\lucene-analyzers-common-5.1.0.jar;C:\lucene\lucene-5.1.0\demo\lucene-demo-5.1.0.jar org.apache.lucene.demo.IndexFiles -docs C:\lucene\lucene-5.1.0

And to search, you'd do:

java -classpath C:\lucene\lucene-5.1.0\core\lucene-core-5.1.0.jar;C:\lucene\lucene-5.1.0\queryparser\lucene-queryparser-5.1.0.jar;C:\lucene\lucene-5.1.0\analysis\common\lucene-analyzers-common-5.1.0.jar;C:\lucene\lucene-5.1.0\demo\lucene-demo-5.1.0.jar org.apache.lucene.demo.SearchFiles
like image 64
olive_tree Avatar answered Nov 02 '22 06:11

olive_tree