Compile failed when running a lucene example

2019-09-03 01:18发布

After fixing the error like tools.jar and junit.jar not found (thanks to stack overflow) I tried to compile the example given in "lucene in action" book. But when I compiled I am getting this error. Can you tell what error I am getting and how to fix it?


Total time: 0 seconds

E:\LuceneInAction>ant Indexer
Buildfile: E:\LuceneInAction\build.xml

check-environment:

compile:
[javac] E:\LuceneInAction\build.xml:66: warning: 'includeantruntime' was not
set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] Compiling 104 source files to E:\LuceneInAction\build\classes
[javac] E:\LuceneInAction\src\lia\analysis\AnalyzerUtils.java:3: warning: [d
eprecation] Assert in junit.framework has been deprecated
[javac] import junit.framework.Assert;
[javac]                       ^
[javac] E:\LuceneInAction\src\lia\handlingtypes\html\NekoHTMLHandler.java:18
: error: package org.apache.html.dom does not exist
[javac] import org.apache.html.dom.HTMLDocumentImpl;
[javac]                           ^
[javac] E:\LuceneInAction\src\lia\analysis\AnalyzerUtils.java:90: warning: [
deprecation] Assert in junit.framework has been deprecated
[javac]     Assert.assertEquals(strings.length, tokens.length);
[javac]     ^
[javac] E:\LuceneInAction\src\lia\analysis\AnalyzerUtils.java:93: warning: [
deprecation] Assert in junit.framework has been deprecated
[javac]       Assert.assertEquals("index " + i, strings[i], tokens[i].termTe
xt());
[javac]       ^
[javac] E:\LuceneInAction\src\lia\handlingtypes\html\NekoHTMLHandler.java:32
: error: cannot find symbol
[javac]       new HTMLDocumentImpl().createDocumentFragment();
[javac]           ^
[javac]   symbol:   class HTMLDocumentImpl
[javac]   location: class NekoHTMLHandler
[javac] Note: Some input files use unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
[javac] 2 errors
[javac] 3 warnings

BUILD FAILED
E:\LuceneInAction\build.xml:66: Compile failed; see the compiler error output fo
r details.

Total time: 2 seconds

Sorry I dont have enough reputaion to post image

1条回答
放荡不羁爱自由
2楼-- · 2019-09-03 01:39

Tt is complaining about your jar which contains HtmlDocumentImpl not being on the classpath. Maybe xerces? A specific version. The JUnits are a warning that it the Assert which comes from org.framework. You can update your JUnit jar file or leave it as is since that isnt the cause of the error.

The errors are due to a jar not being on your classpath. which in my guess is xerces

查看更多
登录 后发表回答