문제

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?

도움이 되었습니까?

해결책

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.

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top