0

如何在类路径中包含多个类文件和 .Jar 文件,我在 linux 上 .. 并且想将下载的 lucene 包与我的代码集成,所有库和类文件都在 lucene 目录中。(它们是该文件夹内的多个子目录)?

HelloLucene.java:1: error: package org.apache.lucene.analysis.standard does not exist
import org.apache.lucene.analysis.standard.StandardAnalyzer;
                                          ^
HelloLucene.java:10: error: package org.apache.lucene.queryparser.classic does not exist
import org.apache.lucene.queryparser.classic.ParseException;
                                            ^
HelloLucene.java:11: error: package org.apache.lucene.queryparser.classic does not exist
import org.apache.lucene.queryparser.classic.QueryParser;
                                            ^
HelloLucene.java:23: error: cannot find symbol
  public static void main(String[] args) throws IOException, ParseException {
                                                             ^
  symbol:   class ParseException
  location: class HelloLucene
    HelloLucene.java:26: error: cannot find symbol
    StandardAnalyzer analyzer = new StandardAnalyzer(Version.LUCENE_40);
    ^
  symbol:   class StandardAnalyzer
  location: class HelloLucene
HelloLucene.java:26: error: cannot find symbol
    StandardAnalyzer analyzer = new StandardAnalyzer(Version.LUCENE_40);
                                    ^
  symbol:   class StandardAnalyzer
  location: class HelloLucene
HelloLucene.java:45: error: cannot find symbol
    Query q = new QueryParser(Version.LUCENE_40, "title", analyzer).parse(querystr);
                  ^
  symbol:   class QueryParser
  location: class HelloLucene
Note: HelloLucene.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
7 errors
4

2 回答 2

0

您可以将路径添加到 jar 所在的文件夹中,然后递归地选择内部 jar。

于 2013-06-21T10:35:23.640 回答
0

使用以下命令:

export CLASSPATH="$CLASSPATH:xyz.jar**:**path_to_abc.jar.jar"

您基本上必须将所需的所有新条目附加到类路径中。为此,只需在 linux 中使用 ':' 和 ';' 在窗户里。

于 2013-06-21T10:17:35.130 回答