Java 库类无法识别?

发布于 2024-12-31 21:28:44 字数 348 浏览 0 评论 0原文

导入以下内容:

import org.apache.lucene.analysis.PorterStemmer

我正在Java 程序中 整个包可以在参考库中找到。

我尝试导入

import org.apache.lucene.analysis.PorterStemFilter

import org.apache.lucene.analysis.Analyzer;

除了提到的第一个之外,两者都工作正常 有人能指出原因吗?!

I am importing this following :

import org.apache.lucene.analysis.PorterStemmer

in Java program. The whole package is available in refrenced library.

I tried importing

import org.apache.lucene.analysis.PorterStemFilter

and

import org.apache.lucene.analysis.Analyzer;

both are working fine except the first one mentioned
Can anybody point out why ?!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

莫多说 2025-01-07 21:28:44

包 org.apache.lucene.analysis.PorterStemmer 不是公共包,这就是您无法导入它的原因。如果您在库中查看此包,您会发现它以 class PorterStemmer 开头,而不是 public class PorterStemmer

Package org.apache.lucene.analysis.PorterStemmer is not a public package which is why you cannot import it. If you look at this package inside the library, you'll notice that it begins with class PorterStemmer instead of public class PorterStemmer.

愿与i 2025-01-07 21:28:44

我的猜测是您有一个不同版本的 Lucene JAR,它不包含无法工作的类。使用 WinZip、7Zip 或其他工具打开 JAR,看看该类是否确实丢失。如果是,您要么需要找到包含它的 JAR 版本,要么重写代码以使用替代方案。

My guess is that you have a different version of the Lucene JAR that doesn't contain the class that's failing to work. Open the JAR with WinZip, 7Zip, or some other tool and see if that class is indeed missing. If it is, you either need to find a version of the JAR that has it or rewrite your code to use an alternative.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文