Startup() SingleFrameApplication 出现问题警告:getApplicationResourceMap():没有应用程序类

发布于 2024-12-06 09:35:43 字数 1276 浏览 2 评论 0原文

我使用 NetBeans 创建了一个项目。我做了一个检查更新的课程。如果有则进行升级,否则将启动主项目类。

问题是当我创建 MyClassApp 对象并使用 myClass.startup() 启动时,我得到了这些错误......我以为这是我的更新类,所以我尝试使用普通的 main ,而不需要任何东西,只需创建 MyClassApp 并启动​​startup()但它得到了同样的错误。

我该如何修复它?

26-set-2011 12.34.32 org.jdesktop.application.ResourceManager getApplicationResourceMap
WARNING: getApplicationResourceMap(): no Application class
26-set-2011 12.34.36 org.jdesktop.application.SingleFrameApplication initRootPaneContainer
WARNING: couldn't restore sesssion [mainFrame.session.xml]
java.lang.NullPointerException
    at org.jdesktop.application.LocalStorage.getApplicationId(LocalStorage.java:195)
    at org.jdesktop.application.LocalStorage.getDirectory(LocalStorage.java:234)
    at org.jdesktop.application.LocalStorage$LocalFileIO.openInputFile(LocalStorage.java:330)
    at org.jdesktop.application.LocalStorage.openInputFile(LocalStorage.java:76)
    at org.jdesktop.application.LocalStorage.load(LocalStorage.java:138)
    at org.jdesktop.application.SessionStorage.restore(SessionStorage.java:382)
    at org.jdesktop.application.SingleFrameApplication.initRootPaneContainer(SingleFrameApplication.java:231)
    at org.jdesktop.application.SingleFrameApplication.show(SingleFrameApplication.java:463)

I created a project with NetBeans. I did a class that checkForUpdates. If there are it does the updgrade otherwise it starts main project class.

The problem is when i Create object of MyClassApp and i launch with myClass.startup() i got those errors....I thought that was my update class so I tryed with a normal main without anything just create MyClassApp and launch startup() but it gets the same errors.

How can i fix it?

26-set-2011 12.34.32 org.jdesktop.application.ResourceManager getApplicationResourceMap
WARNING: getApplicationResourceMap(): no Application class
26-set-2011 12.34.36 org.jdesktop.application.SingleFrameApplication initRootPaneContainer
WARNING: couldn't restore sesssion [mainFrame.session.xml]
java.lang.NullPointerException
    at org.jdesktop.application.LocalStorage.getApplicationId(LocalStorage.java:195)
    at org.jdesktop.application.LocalStorage.getDirectory(LocalStorage.java:234)
    at org.jdesktop.application.LocalStorage$LocalFileIO.openInputFile(LocalStorage.java:330)
    at org.jdesktop.application.LocalStorage.openInputFile(LocalStorage.java:76)
    at org.jdesktop.application.LocalStorage.load(LocalStorage.java:138)
    at org.jdesktop.application.SessionStorage.restore(SessionStorage.java:382)
    at org.jdesktop.application.SingleFrameApplication.initRootPaneContainer(SingleFrameApplication.java:231)
    at org.jdesktop.application.SingleFrameApplication.show(SingleFrameApplication.java:463)

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

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

发布评论

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

评论(1

行雁书 2024-12-13 09:35:43

我不知道是什么原因导致这个错误,但我有一个解决方案。

您可能有一个如下定义的类:

public class MyClassApp extends SingleFrameApplication {
  ...
  @Override protected void startup() {
    show(new MyClassApp (this));
  }
  ...
  public static MyClassApp getApplication() {
    return Application.getInstance(MyClassApp.class);
  }
  ...
}

如果您使用以下命令启动您的应用程序,

MyClassApp.getApplication().startup();

您可能不会收到任何错误。

I don't know what causes this error, but I have a solution.

You probably have a class as defined below:

public class MyClassApp extends SingleFrameApplication {
  ...
  @Override protected void startup() {
    show(new MyClassApp (this));
  }
  ...
  public static MyClassApp getApplication() {
    return Application.getInstance(MyClassApp.class);
  }
  ...
}

If you start your application with

MyClassApp.getApplication().startup();

You probably won't get any error.

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