导入org.xxx无法解决

发布于 2025-01-31 19:53:00 字数 359 浏览 2 评论 0原文

我是Java的新手,所以请忍受我...

我已经将JFReechart-1.5.0.Jar文件放在LIB文件夹中,并想做一些这样的导入:

import org.jfree.chart.ChartFactory;

但是VS代码在抱怨:导入org。 JFRE无法解决。

我要提到的一件事是,我创建了一个项目文件夹的副本,以便尝试某些内容。因为它起作用,所以我删除了原始文件夹,并将副本重命名为原始文件夹的名称。

但是现在我有一个问题是导入不再起作用,即使是相同的代码也是如此。我已经“清洁了Java语言服务器工作区”,但这无济于事。

我还有什么要做的吗? JAR导入指向某个路径 /文件吗?

I'm new to Java, so bear with me...

I have placed a jfreechart-1.5.0.jar file in a lib folder and wanted to do do some imports like this:

import org.jfree.chart.ChartFactory;

But VS Code is complaining: the import org.jfree cannot be resolved.

One thing I have to mention is, that I have created a copy of the project folder in order to try something. Because it worked, I have deleted the original folder and renamed the copy to the name of the original folder.

But now I have the problem that the imports do not work anymore, even it's the same code. I have "cleaned Java language server workspace" but it didn't help.

Is there anything else I have to do? Is the jar import pointing to a certain path / file?

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

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

发布评论

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

评论(2

空城之時有危險 2025-02-07 19:53:00

对于Maven项目,您可以通过单击项目视图中Maven依赖性节点旁边的 +图标来添加依赖关系。

如果您的项目是一个不管理的文件夹,而没有任何构建工具。您可以通过单击引用的库节点上的 +图标或 - 图标来管理依赖项。

For Maven project, you can add a dependency by clicking the + icon next to Maven Dependencies node in project view.

enter image description here

If your project is an unmanaged folder without any build tools. You can manage the dependencies by clicking the + icon or the - icon on the Referenced Libraries node or the items under it.

enter image description here

白首有我共你 2025-02-07 19:53:00

我必须将JAR文件引用到项目。
出乎意料的是,第一次自动引用它时,我第二次必须手动进行……

“

I had to reference the jar file to the project.
Surprisingly the first time it has been referenced automatically, the second time I had to do it manually...

screenshot of VS Code setting

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