2011-02-12 53 views
1

我在这里真的很傻(或者只是“愚蠢”)。我在我的相对较新的Mac上使用JRE系统库(JVM内容(MacOS X默认),Hibernate 3.0和MigLayout在Eclipse Helios中构建了一个简单的Java Swing应用程序。事情进展顺利,直到我开始看到以下错误消息防止在GUI从甚至渲染__NSAutoreleaseNoPool在SWING应用程序中抛出

2011-02-12 09:40:27.842 java[809:903] [Java CocoaComponent compatibility mode]: Enabled 
2011-02-12 09:40:27.843 java[809:903] [Java CocoaComponent compatibility mode]: Setting timeout for SWT to 0.100000 
2011-02-12 09:41:08.355 java[809:903] *** __NSAutoreleaseNoPool(): Object 0x1001575c0 of class NSConcreteMapTableValueEnumerator autoreleased with no pool in place - just leaking 

,当我使用这个简单的代码实例化一个JButton前两行抛出:

private JButton button = new JButton(); 

最后一行是在叫我的控制器的结论抛出Main()中的构造函数。

public static void main(String[] args) { 

     // Creates a model of the system logic. 
    LeapsAndBoundsModel model = new LeapsAndBoundsModel(); 

     // Creaties a view for the system logic. 
    LeapsAndBoundsView leapsAndBoundsView = new LeapsAndBoundsView(); 

     // Creates a controller that links the two. 
    LeapsAndBoundsController controller = new LeapsAndBoundsController(model, leapsAndBoundsView); 
     } 

我谷歌搜索了这个问题,发现很多人都有同样的问题,但几乎所有人都使用CocoaComponent for iPhone应用程序进行编码。这是一个简单的GUI,它使用Hibernate将信息保存到本地化的Derby数据库中。

我都试过了以下建议没有成功:

//Set the CocoaComponent CompatibilityMode to "False" 
System.setProperty("com.apple.eawt.CocoaComponent.CompatibilityMode", "false"); 

// Use the "invokeLater" method within Main() construct 
     SwingUtilities.invokeLater(new Runnable() { 

      public void run() { 
       doIt(); 
      }  
     }); 

任何帮助将不胜感激。

+0

您可以发布一个完整的自包含代码示例,生成此错误?只需一个具有创建JFrame的主方法的类,并添加JButton和生成错误消息所需的其他任何东西。这将使我们更容易找到并解决问题。 – 2011-02-13 12:03:35

回答

相关问题