Question

I wanted to use lucene library. I have downloaded it and added it as Zip file [project properties--> Libraries --> Add Jar/Folder]to my project. But I simply cannot import it. when i type in:

import org.apache.lucene.analysis.Token;

it simply says package does not exist!

if i type

import org.

it gives me some suggestions but no apache.

Netbeans works fine since i already imported guava.jar and using the google.common libraries.

Does it has anything to do with me adding a zip as the library? shall i do something extra after i added zip file? is there anywhere that i should check?

Was it helpful?

Solution

I think you downloaded a zip containing several lucene jar files.

That zip contains different lucenes jar files, you need to extract it and add

  • core/lucene-core-4.8.0.jar
  • analysis/common/lucene-analyzers-common-4.8.0.jar

as dependencies to your project.

OTHER TIPS

It is easier to simply download the jar files and add them to your class path.

Note that importing only the Lucene Core jar would not work, as the Analyzers are in a separate jar named lucene-analyzers-common-{version}.jar.

At Maven Repository you can find the most recent versions of the Analyzers jar and the Core jar.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top