Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8652049
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T14:13:01+00:00 2026-06-12T14:13:01+00:00

i just made a basic calculator project in netbeans, and when i run the

  • 0

i just made a basic calculator project in netbeans, and when i run the project there the code works just fine, and when i go to docs> netbeans projects>dist>calculator.jar, and run it there it works but when i drag that to desktop and try to run it there the JFrame won’t open

here is the only class below:

package calculator;

/**
 *
 * @author David
 */
public class ui extends javax.swing.JFrame {

    /**
     * Creates new form ui
     */
    public ui() {
        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() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        jScrollBar1 = new javax.swing.JScrollBar();
        jLabel1 = new javax.swing.JLabel();
        addBut = new javax.swing.JRadioButton();
        subBut = new javax.swing.JRadioButton();
        mulBut = new javax.swing.JRadioButton();
        divBut = new javax.swing.JRadioButton();
        intOneText = new javax.swing.JTextField();
        intTwoText = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        result = new javax.swing.JLabel();
        goButton = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); // error here

        jLabel1.setText("Calculator");
        getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 60, -1, -1));

        buttonGroup1.add(addBut);
        addBut.setText("Add");
        getContentPane().add(addBut, new org.netbeans.lib.awtextra.AbsoluteConstraints(200, 110, -1, -1));

        buttonGroup1.add(subBut);
        subBut.setText("Subtract");
        getContentPane().add(subBut, new org.netbeans.lib.awtextra.AbsoluteConstraints(260, 110, -1, -1));

        buttonGroup1.add(mulBut);
        mulBut.setText("Multiply");
        getContentPane().add(mulBut, new org.netbeans.lib.awtextra.AbsoluteConstraints(200, 140, -1, -1));

        buttonGroup1.add(divBut);
        divBut.setText("Divide");
        getContentPane().add(divBut, new org.netbeans.lib.awtextra.AbsoluteConstraints(280, 140, -1, -1));
        getContentPane().add(intOneText, new org.netbeans.lib.awtextra.AbsoluteConstraints(89, 131, 83, -1));
        getContentPane().add(intTwoText, new org.netbeans.lib.awtextra.AbsoluteConstraints(90, 180, 83, -1));

        jLabel2.setText("Integer 1:");
        getContentPane().add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 134, -1, -1));

        jLabel3.setText("Integer 2:");
        getContentPane().add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 180, -1, -1));

        result.setText("Solution Will Appear Here");
        getContentPane().add(result, new org.netbeans.lib.awtextra.AbsoluteConstraints(180, 220, -1, -1));

        goButton.setText("Calculate");
        goButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                goButtonMouseClicked(evt);
            }
        });
        getContentPane().add(goButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(59, 218, -1, -1));

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

    private void goButtonMouseClicked(java.awt.event.MouseEvent evt) {                                      

        if(intOneText.getText().equals("")){
             result.setText("Something is missing here...");
         }
         if(intTwoText.getText().equals("")){
             result.setText("Something is missing here...");
         }

        String intOne = intOneText.getText();
        float numOne = Float.parseFloat(intOne);
        String intTwo = intTwoText.getText();
        float numTwo = Float.parseFloat(intTwo);
        float answer = 0;

        boolean addTrue = false;
        boolean subTrue = false;
        boolean mulTrue = false;
        boolean divTrue = false;


        if(addBut.isSelected()){
            addTrue = true;
            subTrue = false;
            mulTrue = false;
            divTrue = false;
        }

        if(subBut.isSelected()){
            addTrue = false;
            subTrue = true;
            mulTrue = false;
            divTrue = false;
        }

        if(mulBut.isSelected()){
            addTrue = false;
            subTrue = false;
            mulTrue = true;
            divTrue = false;
        }

        if(divBut.isSelected()){
            addTrue = false;
            subTrue = false;
            mulTrue = false;
            divTrue = true;
        }

        if(addTrue == false){
            if(subTrue == false){
                if(mulTrue == false){
                    if(divTrue == false){
                         result.setText("Something is missing here...");
                    }
                }
            }
        }


       if(addTrue == true){
           answer = numOne + numTwo;
       }
       if(subTrue == true){
           answer = numOne - numTwo;
       }
       if(mulTrue == true){
           answer = numOne * numTwo;
       }
       if(divTrue == true){
           answer = numOne / numTwo;
       }

       result.setText(Float.toString(answer));

    }                                     

    /**
     * @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 ex) {
            java.util.logging.Logger.getLogger(ui.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(ui.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(ui.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(ui.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

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


            }
        });
    }
    // Variables declaration - do not modify                     
    private javax.swing.JRadioButton addBut;
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JRadioButton divBut;
    private javax.swing.JButton goButton;
    private javax.swing.JTextField intOneText;
    private javax.swing.JTextField intTwoText;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JScrollBar jScrollBar1;
    private javax.swing.JRadioButton mulBut;
    private javax.swing.JLabel result;
    private javax.swing.JRadioButton subBut;
    // End of variables declaration                   
} 

The error that i get in the command line is:

Exception in thread”AWT-EventQueue-0″ java.Lang.NoClassDefFoundError: org/netbeans/lib/awtExtra/AbsoluteLayout

at line 44… (commented above)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T14:13:02+00:00Added an answer on June 12, 2026 at 2:13 pm

    Are you trying to double-click the JAR file? Because that won’t work.

    You have to open up a cmd and type:
    java -jar calculator.jar

    I think it’s case sensitive, so CALCULATOR.JAR won’t work. You need the .jar extension.

    There is a way to make it executable via doubleclicking but that requires extra steps.

    Good luck!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have made a new windows service which works fine using barebone code (just
I have made a basic ascx control which is just a panel with a
I made a very basic dictionary that just stores a username in it, and
so I'm making some basic programming language (just for exercise). I've made simple grammar
I just made a transaction go through but not sure where there is a
I've just made a basic Hello World app for the iPhone. Compiling and running
I've made a basic cart for my web app, I'm just having a hard
I made a TicTacToe Game! Just for fun. It works and all, but can't
I just made my first .net website. I'm trying to use the following line
I just made my first website , and I notice that the elements start

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.