我尝试运行Lucene Indexer,但它给了我以下错误:
java.lang.NoClassDefFoundError: org/apache/lucene/analysis/Analyzer
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.privateGetMethodRecursive(Unknown Source)
at java.lang.Class.getMethod0(Unknown Source)
at java.lang.Class.getMethod(Unknown Source)
at sun.launcher.LauncherHelper.validateMainClass(Unknown Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.apache.lucene.analysis.Analyzer
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 7 more
Exception in thread "main"
我使用了编译命令:
javac -classpath 'C:/Users/Daniel/desktop/Java WorkSpace/JavaPackage/lucene-3.0.0/lucene-core-3.0.0.jar' Indexer.java;
它有效。
但是当我尝试执行编译的类时:
java Indexer;
它给了我ClassNotFoundException()。 PS:编译的类文件和jar文件不在同一个文件夹中。那会有关系吗?
谢谢!
答案 0 :(得分:0)
Lucene分析仪不再是Lucene核心。在此处下载相应版本的JAR(或添加到您的Maven依赖项):http://mvnrepository.com/artifact/org.apache.lucene/lucene-analyzers