NetBeans 错误:包组织不存在

发布于 2024-12-25 04:33:16 字数 153 浏览 1 评论 0原文

我刚刚安装了 Netbeans IDE。我现在无法导入任何 org.* 库,它只是说包 org 不存在。 另外,我将 jdic.jar 导入到项目中,尽管代码完成建议显示为 org.jdesktop.*,但它显示了相同的错误。

我该如何解决这个问题?

I just installed Netbeans IDE. I am now unable to import any org.* libs and it just says package org does not exist.
Also, I imported jdic.jar into the project and even though the code completion suggestions show up as org.jdesktop.*, it shows the same error.

How do I fix this?

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

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

发布评论

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

评论(7

浮光之海 2025-01-01 04:33:16

清除缓存修复了它。
在 Windows 7 中,缓存位于在

C:\Users\username\AppData\Local\NetBeans\...

Linux 上,缓存位于:

/home/username/.cache/netbeans/...

清除缓存并重新启动 netbeans 时,它开始再次识别 org.* 导入。

Clearing the cache fixed it.
In windows 7 the cache is located in

C:\Users\username\AppData\Local\NetBeans\...

On Linux, the cache is at:

/home/username/.cache/netbeans/...

On clearing the cache, and restarting netbeans, it started to recognize org.* imports again.

动次打次papapa 2025-01-01 04:33:16

我很容易做到这一点,只需单击 Jframe,在 Navigator 选项卡上,右键单击 ->设置布局->绝对布局,是的,它对我有用。

输入图像描述这里

I did it easily, just click the Jframe, on Navigator tab, right-click -> Set Layout -> Absolute Layout and YEP, It works for me.

enter image description here

も让我眼熟你 2025-01-01 04:33:16

org.netbeans.lib.awtextra 是 AbsoluteLayout 库的一部分。每当在表单中使用绝对布局时,IDE 都会自动添加它。但是,如果在使用绝对布局后切换到其他布局,则 jar/库将从类路径中删除,并且调用该库的现有代码将无法编译。

  • 如果您想使用绝对布局,请在项目中包含该库。在项目中选择“库”节点,右键单击并选择“添加库”,然后从可用库列表中选择“绝对布局”库。

  • 如果您不想使用绝对布局,那么最好取消注释/删除依赖库的代码,并使用新布局重新进行表单设计。

org.netbeans.lib.awtextra is part of the AbsoluteLayout library. It should be added automatically by the ide whenever absolutelayout is used in the form. But if you switch to some other layout after using absolute layout, then the jar/library will be removed from the classpath and existing code making calls to the library will not compile.

  • If you would like to use absolute layout, then please include the library in the project. Select 'Libraries' node in the project, right-click and select 'Add Library' and select 'Absolute Layout' library from the list of available libraries.

  • If you do not wish to use absolute layout, then it is best to uncomment/remove code relying on the library and re-do the form design using the new layout.

南巷近海 2025-01-01 04:33:16

你可以尝试导入

import org.xml.sax.Attributes;

This is part of JDK.如果你找不到它,那就真的出了问题。


我怀疑您需要将库添加到您的 maven pom.xml 文件中。

Can you try importing

import org.xml.sax.Attributes;

This is part of the JDK. If you can't find that, something is really wrong.


I suspect you need to add the libraries to your maven pom.xml file.

迷爱 2025-01-01 04:33:16

您应该通过退出 netbeans 然后重新打开它来重定向所有丢失的 .jar 文件。应该会出现一个提示,要求您帮助 IDE 查找 .jar 文件。所以请这样做。如果您找不到 jar 文件。清理并构建单独的包。将在包目录中创建一个名为 dist 目录的新目录。现在您可以重定向它们。

You should redirect all the lost .jar files by exiting netbeans, then reopening it. There should be a prompt asking you to help the IDE find the .jar files. So please do so. If you aren't able to find the jar file. Clean and build the individual packages. There a new directory called a dist directory will be created in the package directory. Now you can redirect them.

别忘他 2025-01-01 04:33:16

上面对我不起作用,所以我尝试了下面及其工作:

  1. Google“absolutelayout.jar download”
  2. 下载 jar
  3. 打开 NetBeans 并将此“AbsoluteLayout-RELEASE***.jar”文件添加到项目库文件夹中。
  4. 现在尝试运行项目/文件

Above was not working for me so I tried below and its working:

  1. Google "absolutelayout.jar download"
  2. Download jar
  3. Open NetBeans and Add this "AbsoluteLayout-RELEASE***.jar" file to your project Library folder.
  4. now try to run the project/file
笑,眼淚并存 2025-01-01 04:33:16

根据我的经验,问题出在带有 AbsoluteLayout 的 Jpanel 上,我进行了自由设计并解决了问题

in my experience the problem was with a Jpanel with AbsoluteLayout, I put free-design and solved the problem

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