javanetbeansnetbeans-11java-13

Generic "Link Error" while working with Netbeans forms


I have inherited a NetBeans project that I must make some changes too. I do not have a ton of experience in NetBeans and I have an issue with the app. The app is basically an attendance system that uses MySQL to store and retrieve data. My issue comes from the initial login form which is Login.java . I am able to successfully login via credentials retrieved from MySQL. However, upon successful login, I receive a generic "Link Error" in the output window with no further explanation. Is this a generic error stating that the next form could not be loaded? I am a little perplexed as to what the actual issue is. After a successful login, Login.java should load Admin_main.java which is the second form. Can anyone shed some light on what may be wrong here? I would really appreciate any help!! The error just does not make any sense to me. Thank you so much in advance!

Update -- Here is the relevant code. Whenever this form runs, it generates a link error. No more info, no less. It's a pretty basic form. I just dont get it.

import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Frame;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;


public class stink_belt extends javax.swing.JFrame {

    /**
     * Creates new form stink_belt
     */
    String adminid=null;
    CardLayout card=new CardLayout();
    skunk_ditch st=null;
    stink_cell sub=null;
    flush_rocket fac=null;
    riggity_ras dept=null;
    man_child user=null;
    rocket_tail schedual=null;
    Knocker_knot webcam=null;
    PeeTomSue rptgn=null;
    public stink_belt() {
        initComponents();

        panel_main.setLayout(card);
        st=new skunk_ditch();
        sub=new stink_cell();
        fac=new flush_rocket();
        dept=new riggity_ras();
        user=new man_child();
        schedual=new rocket_tail(); 
        webcam=new Knocker_knot();
        rptgn=new PeeTomSue();

        panel_main.add(webcam,"Knocker_knot");
        panel_main.add(rptgn,"PeeTomSue");
        panel_main.add(st,"skunk_ditch");
        panel_main.add(dept,"riggity_ras");
        panel_main.add(fac,"flush_rocket");
        panel_main.add(sub,"stink_cell");
        panel_main.add(user,"man_child");
        panel_main.add(schedual,"rocket_tail");
        //new mainserver();

    }
    /**
     * 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() {

        panel_main = new javax.swing.JPanel();
        jMenuBar1 = new javax.swing.JMenuBar();
        dbmgmt = new javax.swing.JMenu();
        studentmgmt = new javax.swing.JMenuItem();
        submgmt = new javax.swing.JMenuItem();
        facultymgmt = new javax.swing.JMenuItem();
        deparmentmgmt = new javax.swing.JMenuItem();
        usermanagement = new javax.swing.JMenuItem();
        schedualmanagement = new javax.swing.JMenuItem();
        webcams = new javax.swing.JMenu();
        allwebcams = new javax.swing.JMenuItem();
        jMenu1 = new javax.swing.JMenu();
        aggregate_att = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Welcome");
        setName("stink_belt"); // NOI18N
        setPreferredSize(new java.awt.Dimension(930, 525));
        addWindowFocusListener(new java.awt.event.WindowFocusListener() {
            public void windowGainedFocus(java.awt.event.WindowEvent evt) {
                formWindowGainedFocus(evt);
            }
            public void windowLostFocus(java.awt.event.WindowEvent evt) {
            }
        });
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowOpened(java.awt.event.WindowEvent evt) {
                formWindowOpened(evt);
            }
        });

        panel_main.setPreferredSize(new java.awt.Dimension(930, 504));

        javax.swing.GroupLayout panel_mainLayout = new javax.swing.GroupLayout(panel_main);
        panel_main.setLayout(panel_mainLayout);
        panel_mainLayout.setHorizontalGroup(
            panel_mainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 930, Short.MAX_VALUE)
        );
        panel_mainLayout.setVerticalGroup(
            panel_mainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 504, Short.MAX_VALUE)
        );

        dbmgmt.setText("Rocket Management");

        studentmgmt.setText("Leper Management");
        studentmgmt.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                studentmgmtActionPerformed(evt);
            }
        });
        dbmgmt.add(kittymgmt);

        submgmt.setText("Subject Management");
        submgmt.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                submgmtActionPerformed(evt);
            }
        });
        dbmgmt.add(rotmgmt);

        facultymgmt.setText("Faculty Management");
        facultymgmt.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                facultymgmtActionPerformed(evt);
            }
        });
        dbmgmt.add(stinkmgmt);

        deparmentmgmt.setText("Department Management");
        deparmentmgmt.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                deparmentmgmtActionPerformed(evt);
            }
        });
        dbmgmt.add(deparmentmgmt);

        usermanagement.setText("User Management");
        usermanagement.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                usermanagementActionPerformed(evt);
            }
        });
        dbmgmt.add(usermanagement);

        schedualmanagement.setText("Calendar Management");
        schedualmanagement.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                schedualmanagementActionPerformed(evt);
            }
        });
        dbmgmt.add(schedualmanagement);

        jMenuBar1.add(dbmgmt);

        webcams.setText("Knockers");

        allwebcams.setText("All Webcams");
        allwebcams.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                allwebcamsActionPerformed(evt);
            }
        });
        webcams.add(allwebcams);

        jMenuBar1.add(webcams);

        jMenu1.setText("Report Generation");

        aggregate_att.setText("Aggregate stink");
        aggregate_att.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                aggregate_attActionPerformed(evt);
            }
        });
        jMenu1.add(aggregate_att);

        jMenuBar1.add(jMenu1);

        jMenu2.setText("Change Password");
        jMenu2.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jMenu2.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        jMenu2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jMenu2MouseClicked(evt);
            }
        });
        jMenuBar1.add(jMenu2);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(panel_main, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(panel_main, javax.swing.GroupLayout.DEFAULT_SIZE, 503, Short.MAX_VALUE)
        );

        panel_main.getAccessibleContext().setAccessibleName("");
        panel_main.getAccessibleContext().setAccessibleDescription("");

        getAccessibleContext().setAccessibleName("stink_belt");

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

    private void studentmgmtActionPerformed(java.awt.event.ActionEvent evt) {                                            
        // TODO add your handling code here:
        card.show(panel_main,"skunk_ditch");
        panel_main.setSize(st.getPreferredSize());
        this.setSize(panel_main.getSize().width+20,panel_main.getSize().height+60);
    }                                           

    private void submgmtActionPerformed(java.awt.event.ActionEvent evt) {                                        
        // TODO add your handling code here:
        card.show(panel_main,"stink_cell");
        panel_main.setSize(sub.getPreferredSize());
        this.setSize(panel_main.getSize().width+20,panel_main.getSize().height+60);
    }                                       

    private void formWindowOpened(java.awt.event.WindowEvent evt) {                                  
        // TODO add your handling code here:
        this.setLocationRelativeTo(null);
        card.show(panel_main,"Knocker_knot");
        panel_main.setSize(webcam.getPreferredSize());
        this.setSize(this.getMaximumSize().width,this.getMaximumSize().height);
        this.setExtendedState(JFrame.MAXIMIZED_BOTH);
        this.getContentPane().setBackground(Color.WHITE);
        SwingUtilities.updateComponentTreeUI(this);
    }                                 

    private void facultymgmtActionPerformed(java.awt.event.ActionEvent evt) {                                            
        // TODO add your handling code here:
        card.show(panel_main,"flush_rocket");
        panel_main.setSize(fac.getPreferredSize());
        this.setSize(panel_main.getSize().width+20,panel_main.getSize().height+60);
    }                                           

    private void deparmentmgmtActionPerformed(java.awt.event.ActionEvent evt) {                                              
        // TODO add your handling code here:
        card.show(panel_main,"riggity_ras");
        panel_main.setSize(dept.getPreferredSize());
        this.setSize(panel_main.getSize().width+50,panel_main.getSize().height+60);
    }                                             

    private void usermanagementActionPerformed(java.awt.event.ActionEvent evt) {                                               
        // TODO add your handling code here:
        card.show(panel_main,"man_child");
        panel_main.setSize(user.getPreferredSize());
        this.setSize(panel_main.getSize().width+70,panel_main.getSize().height+60);
    }                                              

    private void schedualmanagementActionPerformed(java.awt.event.ActionEvent evt) {                                                   
        // TODO add your handling code here:
        card.show(panel_main,"rocket_tail");
        panel_main.setSize(schedual.getPreferredSize());
        this.setSize(panel_main.getSize().width+30,panel_main.getSize().height+60);
    }                                                  

    private void allwebcamsActionPerformed(java.awt.event.ActionEvent evt) {                                           
        // TODO add your handling code here:
        card.show(panel_main,"Knocker_knot");
        panel_main.setSize(webcam.getSize());
        this.setSize(panel_main.getSize().width+30,panel_main.getSize().height+60);
        this.setExtendedState(JFrame.MAXIMIZED_BOTH);
    }                                          

    private void formWindowGainedFocus(java.awt.event.WindowEvent evt) {                                       
        // TODO add your handling code here:    

    }                                      

    private void aggregate_attActionPerformed(java.awt.event.ActionEvent evt) {                                              
        // TODO add your handling code here:
        card.show(panel_main,"PeeTomSue");
        panel_main.setSize(rptgn.getPreferredSize());
        this.setSize(this.getMaximumSize().width,this.getMaximumSize().height);
        this.setExtendedState(JFrame.MAXIMIZED_BOTH);
    }                                             

    private void jMenu2MouseClicked(java.awt.event.MouseEvent evt) {                                    
        // TODO add your handling code here:
        ChangePassword cp=new ChangePassword();
        cp.txt_userid.setText(adminid);
        cp.setVisible(true);
    }                                   

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(stink_belt.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            @Override
            public void run() {
                new stink_belt().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify                     
    private javax.swing.JMenuItem aggregate_att;
    private javax.swing.JMenuItem allwebcams;
    private javax.swing.JMenu dbmgmt;
    private javax.swing.JMenuItem deparmentmgmt;
    private javax.swing.JMenuItem facultymgmt;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JPanel panel_main;
    private javax.swing.JMenuItem schedualmanagement;
    private javax.swing.JMenuItem studentmgmt;
    private javax.swing.JMenuItem submgmt;
    private javax.swing.JMenuItem usermanagement;
    private javax.swing.JMenu webcams;

Here is a screenshot of NetBeans after the error. The link error actually references run.xml like 94 and 111. There is nothing there that I can identify though.

Java Link Error


Solution

  • I didn't see anything inherently wrong with anything.

    Since you said that it was an inherited project, and you are getting a link error, I am wondering if one of your libraries is out of date or in the wrong location.