Lucene is a Java library. If you don't have a Java development environment set up already, see the Java documentation.
Download the latest version of Lucene from the Apache website, and unzip it.
Add the required jars to your classpath. The following jars will be required by many projects, including the Hello World example here:
core/lucene-core-6.1.0.jar: Core Lucene functionality.
core/analysis/common/lucene-analyzers-common-6.1.0.jar: Provides a variety of analyzers, including the ubiquitous StandardAnalyzer.
queryparser/lucene-queryparser-6.1.0.jar: Provides the query parser.
Place the code in
HelloLucene.java. Compile it with this command:
javac -classpath "core/*:queryparser/*" HelloLucene.java
And run it with this command:
java -classpath ".:core/*:queryparser/*" HelloLucene