如何运行Lucene 4.9 IndexFiles?

时间:2014-08-11 17:43:03

标签: java eclipse lucene

我是Lucene的新手,我正在尝试在Eclipse上运行Lucene 4.9 indexFiles但是我遇到了以下错误  来自IndexWriterConfig iwc = new IndexWriterConfig(Version.LUCENE_4_9, analyzer);的IndexFiles.java类的org.apache.lucene.demo

at org.apache.lucene.index.LiveIndexWriterConfig.<init>(LiveIndexWriterConfig.java:125)
at org.apache.lucene.index.IndexWriterConfig.<init>(IndexWriterConfig.java:171)
at org.apache.lucene.demo.IndexFiles.main(IndexFiles.java:92)Caused by: java.lang.IllegalArgumentException: A SPI class of type org.apache.lucene.codecs.Codec with name 'Lucene49' does not exist. You need to add the corresponding JAR file supporting this SPI to your classpath.The current classpath supports the following names: [SimpleText, Appending, Lucene40, Lucene3x]
at org.apache.lucene.util.NamedSPILoader.lookup(NamedSPILoader.java:109)
at org.apache.lucene.codecs.Codec.forName(Codec.java:95)
at org.apache.lucene.codecs.Codec.<clinit>(Codec.java:122)
... 3 more

1 个答案:

答案 0 :(得分:0)

确保包含lucene核心jar文件,其版本为4.9。如果您刚刚从旧版本迁移到4.9,可能是您在运行时环境上使用了错误版本的lucene jar。

我的意思是你在eclipse上使用正确的jar,但运行时配置指向另一个版本低于4.9的jar。

相关问题