reference: hankcshttp://www.hankcs.com/program/java/ Lucene-combat-2nd-edition-book-with-code-compiled-under-the-idea.html
the most basic ant compilation:
Click the plus sign on the right to load the Build.xml script under LIA2E, then double-click the program in the list for a cell:
Compile and run with idea configuration:
To create a new console configuration, select the main class:
Compile Run Error:
Java: no symbols found
Symbol: Method Next ()
Location: variable ts of type Org.apache.lucene.analysis.TokenStream
This is because Lia/analysis/nutch/nutchexample.java needs to use Lucene 2.4.0, but the book Code is 3.0:
<!–nutch uses Lucene 2.4.0, but the rest of the sources use 3.0.0,
So we set up a separate compile target & classpath–>
The solution is to comment out the nutchexample, in the fourth chapter to use the words and then changed back to use ant compile.
Then the compilation succeeds and the error runs:
Exception in thread "main" java.lang.NullPointerException at java.io.File. <init> (file.java:277) at lia.meetlucene.Indexer. <init> (indexer.java:68) at lia.meetlucene.Indexer.main (Indexer.java:52)
Two fewer parameters, change to:
Public Static void throws Exception { new string[2]; args[0] = "E:/xiaodajun/new/lia2e/src/lia/meetlucene"; args[1] = "E:/xiaodajun/new/lia2e/src/lia/meetlucene/data"; // "Src/lia/meetlucene/data";
When written relative address, still can not solve the problem, change the address to the right.
Or:
Refer to Blog:eclipse, modify program arguments.
"Lucene Combat (2nd Edition)" compilation Method with book code under idea