Java堆空间异常

时间:2012-12-14 14:33:14

标签: java netbeans

 Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
at masterCustomer.initComponents(masterCustomer.java:32)
at masterCustomer.<init>(masterCustomer.java:11)
at MainFrame.<init>(MainFrame.java:19)
at loginForm.<init>(loginForm.java:17)
at MainFrame.<init>(MainFrame.java:20)
at loginForm.<init>(loginForm.java:17)
at MainFrame.<init>(MainFrame.java:20)
at loginForm.<init>(loginForm.java:17)
at MainFrame.<init>(MainFrame.java:20)
at loginForm.<init>(loginForm.java:17)

任何人都知道如何解决这个问题?我从netbeans生成setter和getter后发生这个问题...

1 个答案:

答案 0 :(得分:4)

问题在于loginForm需要引用MainFrame,反之亦然。在这两行中你得到一个无限循环:

 loginForm.java:17
 MainFrame.java:20