在Eclipse中使用Jsoup时出错

发布于 2024-12-17 06:57:37 字数 210 浏览 3 评论 0原文

我从 jsoup.org/download 下载了 .jar Jsoup 文件。然后我运行 eclipse 并将 .jar 文件导入到 java 项目中。 时,我不断收到错误消息

但是,当我输入import org.jsoup.nodes.*;

。我想在该文件中使用 Document 类。

我确保语法和一切都正确,但错误不会消失。有人知道可能是什么问题吗?

I downloaded the .jar Jsoup file from jsoup.org/download. I then ran eclipse and imported the .jar files into a java project. However, I keep getting an error when I type

import org.jsoup.nodes.*;

I want to use the Document class in that file.

I made sure the syntax was correct and everything, but the error won't go away. Anyone know what the problem could be?

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

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

发布评论

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

评论(2

平定天下 2024-12-24 06:57:37

您需要将 JAR 文件添加到项目的构建路径中。将 JAR 拖放到项目的根文件夹或某个 /lib 文件夹中,右键单击 JAR 文件,然后选择“Build Path”>“构建路径”。添加到构建路径。


与具体问题无关,使用通配符导入并不是最佳实践。而是单独指定导入,或者在代码中输入 Document 后输入 Ctrl+Space,让 Eclipse 自动完成导入。

You need to add the JAR file to project's build path. Drop the JAR in the project's root folder or some /lib folder, rightclick the JAR file and then choose Build Path > Add to Build Path.


Unrelated to the concrete problem, using wildcard imports is not the best practice. Rather specify the imports separately, or just let Eclipse autocomplete it by entering Ctrl+Space after typing Document in the code.

浊酒尽余欢 2024-12-24 06:57:37

右键单击 Eclipse 中的项目 >属性> Java 构建路径 >添加罐子>从您之前导入的项目中选择 jar >好的

Right click on project in Eclipse > Properties > Java Build Path > Add Jar > select the jar from your project which you imported before > ok

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