NetBeans 错误:包组织不存在
我刚刚安装了 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
清除缓存修复了它。
在 Windows 7 中,缓存位于在
Linux 上,缓存位于:
清除缓存并重新启动 netbeans 时,它开始再次识别
org.*
导入。Clearing the cache fixed it.
In windows 7 the cache is located in
On Linux, the cache is at:
On clearing the cache, and restarting netbeans, it started to recognize
org.*
imports again.我很容易做到这一点,只需单击 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.
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.
你可以尝试导入
This is part of JDK.如果你找不到它,那就真的出了问题。
我怀疑您需要将库添加到您的 maven
pom.xml
文件中。Can you try importing
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.您应该通过退出 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.
上面对我不起作用,所以我尝试了下面及其工作:
Above was not working for me so I tried below and its working:
根据我的经验,问题出在带有 AbsoluteLayout 的 Jpanel 上,我进行了自由设计并解决了问题
in my experience the problem was with a Jpanel with AbsoluteLayout, I put free-design and solved the problem