Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 04-23-2009, 06:46 AM   #1
LQ Newbie
Registered: Apr 2009
Posts: 1

Rep: Reputation: 0
Exception in thread "main" java.lang.StackOverflowError+ at sun.awt.Win32GraphicsConf


i am beginner in Java Programming. I cannot find my problem (Exception in thread "main" java.lang.StackOverflowError). I did also in goolge, but without result.

Can somebody help me, please?

It would be great of you.


import java.awt.Color;
import java.awt.Font;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;

public class FrameBsp extends JFrame {

private static final long serialVersionUID = 1L;
private FrameBsp siegel = new FrameBsp();
private JLabel labelHallo = new JLabel("Ich bin ein Label!");
private JButton jButtonAbbrechen = new JButton();

FrameBsp() {

super("erster eigener Frame");
siegel.setSize(200, 400);
siegel.labelHallo.setBounds(80,140, 100, 50);
siegel.labelHallo.setFont(new Font("Serif", 1, 22));

siegel.jButtonAbbrechen.setText("Ich bin wieder da!");
//Frame Layout

public static void main(String[] args) {

FrameBsp framebsp = new FrameBsp();
Old 04-23-2009, 08:04 AM   #2
Registered: Sep 2004
Location: Old York, North Yorks.
Distribution: Debian 7 (mainly)
Posts: 653

Rep: Reputation: 97
Originally Posted by siegel View Post
private FrameBsp siegel = new FrameBsp();
Hi siegel,

The problem is the line shown above - you are instantiating the class outside a method, and then again in the main() method. Remove this line and all the uses of the siegel instance variable (or replace them with this and your code will work fine. you would need to add framebsp.setVisible(true) to main() before you see anything), though.

Oh, BTW, this post would have been better in the programming forum . Welcome aboard.

Last edited by Robhogg; 04-23-2009 at 08:06 AM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Exception in thread "main" java.lang.NoClassDefFoundError: org/aspectj/lang/Signature canonas Linux - Software 3 06-16-2008 04:00 AM
Exception in thread "main" java.lang.ClassFormatError: onmyown.Main (unrecognized cla zimboney Fedora 4 07-20-2007 01:00 PM
Exception in thread "main" java.lang.UnsupportedClassVersionError manolakis Programming 2 01-20-2007 10:56 AM
Java error "Exception in thread "main" java.lang.StackOverflowError" nro Programming 1 09-04-2004 03:47 AM
Exception in thread "main" java.lang.NoClassDefFoundError: Lobais Linux - Software 19 06-23-2004 08:42 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:15 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration