2011-09-26 34 views
0

我使用NetBeans創建了一個項目。我做了一個checkForUpdates類。如果有,則執行updgrade,否則啓動主項目類。啓動問題()SingleFrameApplication警告:getApplicationResourceMap():no應用程序類

問題是當我創建MyClassApp的對象,我用myClass.startup()啓動我得到了那些錯誤....我認爲這是我的更新類,所以我嘗試了一個正常的主沒有任何東西只是創建MyClassApp和啓動啓動()但它獲得相同的錯誤。

我該如何解決?

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) 

回答

1

我不知道是什麼原因導致了這個錯誤,但我有一個解決方案。

你可能有一類定義如下:

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(); 

啓動應用程序你可能不會得到任何錯誤。