在Eclipse中使用Jsoup时出错
我从 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要将 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.右键单击 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