先配置
ant
:
C:\Documents and Settings\user>set ANT_HOME=G:\apache-ant-1.6.5
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
C:\Documents and Settings\user>ant -version
Apache Ant version 1.6.5 compiled on June 2 2005
C:\Documents and Settings\user>
must be set in cmd
====================
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
:无法用
cd chang to other directories of disks other than disk c
=================
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\l
ucene-2.0.0
\build
\lucene-core-2.0.1-dev.jar;C:\Program Files\Java\jdk1.5.0_05\li
b;(
不能通过
”
我的电脑
->
属性
”
来设
)
之后:
F:\enterprize\lucene-2.0.0\src\demo>javac org\apache\lucene\demo\IndexFiles.java
F:\enterprize\lucene-2.0.0\src\demo>
^_^
(只是每次开
cmd.exe
后又要重新设
classpath!!????
)