先配置
ant
:
C:\Documents and Settings\user>set ANT_HOME=G:\apache-ant-1.6.5
C:\Documents and Settings\user>ant -version
Apache Ant version 1.6.5 compiled on June 2 2005
C:\Documents and Settings\user>
(
更简单的方式是在系统变量那设
)
C:\Documents and Settings\user>set JAVA_HOME=C:\Program Files\Java\jdk1.5.0_05
C:\Documents and Settings\user>set PATH=%PATH%;%ANT_HOME%\bin
%PATH%;
指原有的
PATH
====================
C:\Documents and Settings\user
>ant -f F:\enterprize\lucene-2.0.0\build.xml
(要下面的弄好后才可以运行此命令)
再下载
lucene-2.0.0.zip,因为只有这个包中才有
lucene-core-2.0.0
.jar
;
和
lucene-demos-2.0.0.
jar
;
―――――――――――――――――――
F:\enterprize\lucene-2.0.0\lucene-core-2.0.0
.jar
;F:\enterprize\lucene-2.0.0\lucene-demos-2.0.0.
jar
;
添加到
classpath
时别漏了
jar!!
添加后java org.apache.lucene.demo.IndexFiles F:\enterprize\lucene-2.0.0-1\src
(第二项不能是IndexFiles,
因为IndexFiles.java
中package org.apache.lucene.demo;
)
可以运行了,嘻嘻
adding F:\enterprize\lucene-2.0.0-1\src\test\org\apache\lucene\StoreTest.java
adding F:\enterprize\lucene-2.0.0-1\src\test\org\apache\lucene\TestDemo.java
adding F:\enterprize\lucene-2.0.0-1\src\test\org\apache\lucene\TestHitIterator.j
ava
adding F:\enterprize\lucene-2.0.0-1\src\test\org\apache\lucene\TestSearch.java
adding F:\enterprize\lucene-2.0.0-1\src\test\org\apache\lucene\TestSearchForDupl
icates.java
adding F:\enterprize\lucene-2.0.0-1\src\test\org\apache\lucene\ThreadSafetyTest.
java
Optimizing...
8632 total milliseconds
F:\enterprize\lucene-2.0.0-1\src\demo\org\apache\lucene\demo>
――――――――――――
运行-
cmd
:
=================
F:\enterprize\lucene-2.0.0\src\demo>javac org\apache\lucene\demo\IndexFiles.java
org\apache\lucene\demo\IndexFiles.java:19:
软件包
org.apache.lucene.analysis.sta
ndard
不存在
import org.apache.lucene.analysis.standard.StandardAnalyzer;
^
org\apache\lucene\demo\IndexFiles.java:20:
软件包
org.apache.lucene.index
不存在
import org.apache.lucene.index.IndexWriter;
于是:
F:\enterprize\lucene-2.0.0\src\demo>
set CLASSPATH=.;%classpath%;F:\enterprize\lucene-2.0.0
\build
\lucene-core-2.0.1-dev.jar; C:\Program Files\Java\jdk1.5.0_05\lib;
之后:
F:\enterprize\lucene-2.0.0\src\demo>javac org\apache\lucene\demo\IndexFiles.java
F:\enterprize\lucene-2.0.0\src\demo>
^_^
----------------------------------
demo3
cd C:\Tomcat 4.1\webapps
java org.apache.lucene.demo.IndexHTML -create -index F:\enterprize\lucene-2.0.0-1\src\demo\org\apache\lucene\demo ..
("java org.apache.lucene.demo.IndexHTML -create -index {index-dir} ..")