java org.jdesktop.application 包不存在
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2070428/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
org.jdesktop.application package doesn't exist
提问by Yatendra Goel
I was building a java desktop application from few days and all was going well.
几天前我正在构建一个 Java 桌面应用程序,一切都很顺利。
But today, when I opened the Netbeans and compiled a file, the following compilation error occrured:
但是今天,当我打开Netbeans并编译文件时,出现了以下编译错误:
Compiling 9 source files to C:\Documents and Settings\Administrator\Desktop\EMS\build\classes
C:\Documents and Settings\Administrator\Desktop\EMS\src\ems\EMSAboutBox.java:7: package org.jdesktop.application does not exist
import org.jdesktop.application.Action;
C:\Documents and Settings\Administrator\Desktop\EMS\src\ems\EMSApp.java:7: package org.jdesktop.application does not exist
import org.jdesktop.application.Application;
C:\Documents and Settings\Administrator\Desktop\EMS\src\ems\EMSApp.java:8: package org.jdesktop.application does not exist
import org.jdesktop.application.SingleFrameApplication;
C:\Documents and Settings\Administrator\Desktop\EMS\src\ems\EMSApp.java:13: cannotfind symbol
symbol: class SingleFrameApplication
public class EMSApp extends SingleFrameApplication {
C:\Documents and Settings\Administrator\Desktop\EMS\src\ems\EMSView.java:7: package org.jdesktop.application does not exist
import org.jdesktop.application.Action;
C:\Documents and Settings\Administrator\Desktop\EMS\src\ems\EMSView.java:8: package org.jdesktop.application does not exist
import org.jdesktop.application.ResourceMap;
C:\Documents and Settings\Administrator\Desktop\EMS\src\ems\EMSView.java:9: package org.jdesktop.application does not exist
I was using the same code before but no error occured like this. When I checked the libraries, then the org.jdesktop.application package is there and when we import that package, the netbeans show the "application" package in suggestion.
我之前使用过相同的代码,但没有发生这样的错误。当我检查库时,org.jdesktop.application 包就在那里,当我们导入该包时,netbeans 建议显示“应用程序”包。
Then why the error is there when the package is already there. If the package was not in the library, then Netbeans would have shown a red line under the import statement, but it is not showing that red line too.
那么当包已经存在时为什么会出现错误。如果包不在库中,那么 Netbeans 会在 import 语句下显示一条红线,但它不会也显示这条红线。
Where is the problem?
哪里有问题?
采纳答案by Bozho
NetBeans has these habit of spontaneously screwing things. Clean your project and rebuild it afresh.
NetBeans 有这些自发搞砸东西的习惯。清理您的项目并重新构建它。
If it doesn't help, clean your workspace.
如果它没有帮助,请清洁您的工作区。
回答by vanrado
I had the same problem. It wasn't problem with netbeans cache or something similar.
我有同样的问题。netbeans 缓存或类似的东西没有问题。
My project depended on some Swing package which was needed to install.
我的项目依赖于一些需要安装的 Swing 包。
Right click on project > Click on Resolve project problems, now just install missing package and problem is solved.
右键单击项目>单击解决项目问题,现在只需安装丢失的包,问题就解决了。

