Results 1 to 6 of 6
  1. #1
    selva.bics is offline Member
    Join Date
    Aug 2009
    Posts
    11
    Rep Power
    0

    Default StackOverflowError

    I have develpoed swing desktop application using netbeans IDE 6.5.1

    it is running in netbeans IDE, Now i want to run this application as jar file.

    i have taken jar, but i could not run this application in windows and Linux

    it shows error like this

    --Exception in thread "AWT-EventQueue-0" java.lang.StackOverflowError

    plz give me solution.

    with regarads
    selva

  2. #2
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    8

    Default

    So post the full stack trace that you got.
    You probably have an infinite loop or are calling some function recursively in a way that will never end.

  3. #3
    pager is offline Member
    Join Date
    Mar 2011
    Posts
    4
    Rep Power
    0

    Default i've got the same problem

    here is the run outcomes;

    run:
    Exception in thread "AWT-EventQueue-0" java.lang.StackOverflowError
    at xer.data.rtm.admin.Menu.setAdmin(Menu.java:68)

    here is the code i build;

    Java Code:
    package xer.data.rtm.admin;
    
    import java.awt.AWTException;
    import java.awt.CardLayout;
    import java.awt.Component;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.sql.Connection;
    import java.sql.SQLException;
    import java.util.logging.Level;
    import java.util.logging.Logger;
    import usu.widget.Form;
    import usu.widget.util.WidgetUtilities;
    import usu.widget.*;
    import xer.data.rtm.data.AdminChiper;
    /**
     *
     * @author pager
     */
    public class Menu extends Form {
        /*
         * Serial version UID
         */
        private static final long serialVersionUID = 1L;
        private Connection connection;
        private AdminChiper admin;
        private String tempString;
    
        /**
         * @param connection
         * @param admin
         */
        public Menu(Connection connection, AdminChiper admin) {
            this();
            this.connection = connection;
            this.admin = admin;
        }
    
        /** Creates new form BeanForm */
        public Menu() {
    
            setIconImage(new javax.swing.ImageIcon(getClass().getResource("/xer/data/rtm/resource/data.png")).getImage());
    
            initComponents();
            initActions();
        }
         /**
         *
         * @param admin
         */
         public void setAdmin(AdminChiper admin) {
            this.admin = admin;
           setAdmin(admin);
        }
        /**
         *
         * @param connection
         */
        public void setConnection(Connection connection) {
            this.connection = connection;
        }
    
        private void initActions() {
            // Menu
            kabupaten.addActionListenerMeral(new AksiButton_Menu_Meral());
        }
    
        void showPanel(Component panel, String card) {
             try {
                if (panel.isVisible()) {
                    return;
                }
                glasspane.startTransition(panelGrad);
                ((CardLayout) panelKart.getLayout()).show(panelKart, card);
            } catch (AWTException ex) {
                Logger.getLogger(Menu.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    
        void setTitleBody(Object object) {
            if (object == null) {
                kab.setText("Kab. Karimun");
            } else {
                kab.setText(kab.getText() + " : " + object);
            }
        }
        void runLoading(String message) {
            button1.setEnabled(false);
            pBar.setIndeterminate(true);
            copy.setText(message);
        }
    
        void doneLoading() {
            button1.setEnabled(true);
            pBar.setIndeterminate(false);
            copy.setText("Kab. Karimun");
        }
    thank you :)

  4. #4
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    8

    Default

    You should have probably started a separate thread.
    If you see the error message it says where the problem is happening i.e your setAdmin method which looks like this:
    Java Code:
    public void setAdmin(AdminChiper admin) {
           this.admin = admin;
           setAdmin(admin);
     }
    So your setAdmin method calls itself over and over again without any stopping condition.

  5. #5
    Quamie is offline Member
    Join Date
    Aug 2011
    Posts
    1
    Rep Power
    0

    Default Exception in thread "AWT-EventQueue-0" java.lang.StackOverflowError

    i am a novice in java programming and i am also getting the same error. this is my code. please help me.

    this the code for the first jpanel

    /*
    * malaika.java
    *
    * Created on Aug 1, 2011, 8:19:17 PM
    */
    package missmalaika;

    /**
    *
    * @author MediaEdge-1
    */
    public class malaika extends javax.swing.JFrame {

    /** Creates new form malaika */
    public malaika() {
    initComponents();
    }

    /** This method is called from within the constructor to
    * initialize the form.
    * WARNING: Do NOT modify this code. The content of this method is
    * always regenerated by the Form Editor.
    */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">
    private void initComponents() {

    jLayeredPane1 = new javax.swing.JLayeredPane();
    canvas1 = new java.awt.Canvas();
    jLabel1 = new javax.swing.JLabel();
    jLabel2 = new javax.swing.JLabel();
    pincode = new javax.swing.JTextField();
    jbtsearch = new javax.swing.JButton();
    jLabel3 = new javax.swing.JLabel();

    setDefaultCloseOperation(javax.swing.WindowConstan ts.EXIT_ON_CLOSE);
    setBackground(new java.awt.Color(73, 139, 56));
    setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
    setForeground(new java.awt.Color(89, 145, 52));
    getContentPane().setLayout(null);
    getContentPane().add(jLayeredPane1);
    jLayeredPane1.setBounds(383, 578, 100, 100);
    getContentPane().add(canvas1);
    canvas1.setBounds(411, 329, 0, 0);

    jLabel1.setFont(new java.awt.Font("Magneto", 0, 25)); // NOI18N
    jLabel1.setForeground(new java.awt.Color(51, 51, 51));
    jLabel1.setHorizontalAlignment(javax.swing.SwingCo nstants.CENTER);
    jLabel1.setText("WELCOME TO MISS MALAIKA 2011");
    jLabel1.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.bor der.BevelBorder.RAISED));
    getContentPane().add(jLabel1);
    jLabel1.setBounds(10, 10, 580, 60);

    jLabel2.setFont(new java.awt.Font("Eras Bold ITC", 0, 14));
    jLabel2.setText("PIN CODE");
    getContentPane().add(jLabel2);
    jLabel2.setBounds(70, 200, 75, 31);

    pincode.setFont(new java.awt.Font("Eras Demi ITC", 0, 12));
    getContentPane().add(pincode);
    pincode.setBounds(40, 240, 139, 30);

    jbtsearch.setFont(new java.awt.Font("Eras Demi ITC", 1, 12));
    jbtsearch.setText("SEARCH");
    jbtsearch.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jbtsearchActionPerformed(evt);
    }
    });
    getContentPane().add(jbtsearch);
    jbtsearch.setBounds(240, 320, 105, 37);

    jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/missmalaika/missmalaika 2011.jpg"))); // NOI18N
    getContentPane().add(jLabel3);
    jLabel3.setBounds(0, 0, 600, 400);

    pack();
    }// </editor-fold>

    private void jbtsearchActionPerformed(java.awt.event.ActionEven t evt) {

    contestantinfo CI = new contestantinfo();
    CI.pack();
    CI.setVisible(rootPaneCheckingEnabled);
    CI.select(pincode);
    // TODO add your handling code here:
    }

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
    java.awt.EventQueue.invokeLater(new Runnable() {

    public void run() {
    new malaika().setVisible(true);
    }
    });
    }
    // Variables declaration - do not modify
    private java.awt.Canvas canvas1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLayeredPane jLayeredPane1;
    private javax.swing.JButton jbtsearch;
    private javax.swing.JTextField pincode;
    // End of variables declaration




    }
    when the pincode is inserted it is expected to print the information related to the pincode on the second jpanel. this is the code.


    package missmalaika;

    import java.awt.*;
    import java.sql.Connection;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import javax.swing.*;

    public class contestantinfo extends javax.swing.JFrame {
    DBConnection db = new DBConnection();


    /** Creates new form contestantinfo */
    public contestantinfo() {
    initComponents();
    }

    /** This method is called from within the constructor to
    * initialize the form.
    * WARNING: Do NOT modify this code. The content of this method is
    * always regenerated by the Form Editor.
    */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">
    private void initComponents() {

    jLabel1 = new javax.swing.JLabel();
    jLabel2 = new javax.swing.JLabel();
    jLabel3 = new javax.swing.JLabel();
    jtfcontestantname = new javax.swing.JTextField();
    jtfage = new javax.swing.JTextField();
    jtfphonenumber = new javax.swing.JTextField();
    jbtok = new javax.swing.JButton();
    jLabel4 = new javax.swing.JLabel();

    setDefaultCloseOperation(javax.swing.WindowConstan ts.EXIT_ON_CLOSE);
    getContentPane().setLayout(null);

    jLabel1.setFont(new java.awt.Font("Eras Demi ITC", 0, 14));
    jLabel1.setText("CONTESTANT NAME");
    getContentPane().add(jLabel1);
    jLabel1.setBounds(20, 70, 150, 32);

    jLabel2.setFont(new java.awt.Font("Eras Demi ITC", 0, 14));
    jLabel2.setText("AGE");
    getContentPane().add(jLabel2);
    jLabel2.setBounds(20, 170, 40, 29);

    jLabel3.setFont(new java.awt.Font("Eras Demi ITC", 0, 14));
    jLabel3.setText("PHONE NUMBER");
    getContentPane().add(jLabel3);
    jLabel3.setBounds(20, 260, 130, 28);

    jtfcontestantname.setFont(new java.awt.Font("Eras Medium ITC", 1, 12));
    getContentPane().add(jtfcontestantname);
    jtfcontestantname.setBounds(80, 110, 291, 28);

    jtfage.setFont(new java.awt.Font("Eras Medium ITC", 1, 12));
    getContentPane().add(jtfage);
    jtfage.setBounds(80, 200, 46, 31);

    jtfphonenumber.setFont(new java.awt.Font("Eras Medium ITC", 1, 12));
    getContentPane().add(jtfphonenumber);
    jtfphonenumber.setBounds(80, 300, 182, 31);

    jbtok.setFont(new java.awt.Font("Eras Demi ITC", 0, 12));
    jbtok.setText("OK");
    jbtok.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jbtokActionPerformed(evt);
    }
    });
    getContentPane().add(jbtok);
    jbtok.setBounds(310, 330, 96, 33);

    jLabel4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/missmalaika/missmalaika 2011.jpg"))); // NOI18N
    getContentPane().add(jLabel4);
    jLabel4.setBounds(0, 0, 600, 410);

    pack();
    }// </editor-fold>

    private void jbtokActionPerformed(java.awt.event.ActionEvent evt) {
    // TODO add your handling code here:
    }

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
    java.awt.EventQueue.invokeLater(new Runnable() {

    public void run() {
    new contestantinfo().setVisible(true);
    }
    });
    }
    // Variables declaration - do not modify
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JButton jbtok;
    private javax.swing.JTextField jtfage;
    private javax.swing.JTextField jtfcontestantname;
    private javax.swing.JTextField jtfphonenumber;
    // End of variables declaration
    public void select(String pincode)
    {
    Connection connection = null;
    PreparedStatement psmnt = null;

    try
    {
    psmnt = db.connection.prepareStatement("SELECT * FROM malaika2011 WHERE pincode = pincode ");
    ResultSet rs = psmnt.executeQuery();
    while(rs.next())
    {
    jtfcontestantname.setText(rs.getString("contestant name"));
    jtfage.setText(rs.getString("age"));
    jtfphonenumber.setText(rs.getString("phonenumber") );
    }
    }
    catch (Exception ep)
    {
    System.out.println("found some error:" + ep);
    }
    }

    void select(JTextField pincode)
    {
    select(pincode);
    }





    }

  6. #6
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    Quamie: please start your own thread for this and re-ask your question there. You'll also want to use code tags when doing so (Please see the link in my signature below).

Similar Threads

  1. java.lang.StackOverflowError Exception
    By Marcus in forum Web Frameworks
    Replies: 4
    Last Post: 08-24-2012, 11:02 PM
  2. java.lang.StackOverflowError
    By malstryx in forum New To Java
    Replies: 9
    Last Post: 10-01-2008, 05:14 AM
  3. java.lang.StackoverflowError
    By ravisankarvivek in forum New To Java
    Replies: 6
    Last Post: 06-23-2008, 10:05 AM
  4. java.lang.StackOverFlowError exception
    By jayaj in forum NetBeans
    Replies: 1
    Last Post: 06-08-2008, 12:17 PM
  5. java.lang.StackOverflowError
    By eva in forum New To Java
    Replies: 3
    Last Post: 12-24-2007, 10:54 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •