I copy and paste code generated from NetBeans into a java file. To run it, I got message "package org.jdesktop.layout does not exit"

What should I do?
Thanks ahead.

Recommended Answers

All 3 Replies

can you share your code please? :)
well, even without looking at your code, it seems that you're just trying to access package that's not there.. :-/ so i guess you need to either create that package.. or... delete that line (in the beginning of the codes)

Here is the code. It works within netBeans. If I run it in the command window with javac, I get message "package org.jdesktop.layout does not exist"

public class report2 extends javax.swing.JFrame {

    /** Creates new form report2 */
    public report2() {
        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.
     */
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">                          
    private void initComponents() {
        displayDrawing = new javax.swing.JPanel();
        infoOutput = new javax.swing.JPanel();
        triggerMatrix = new javax.swing.JToggleButton();
        triggerInclusion = new javax.swing.JToggleButton();
        startCalculation = new javax.swing.JToggleButton();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jMenu2 = new javax.swing.JMenu();
        jMenu3 = new javax.swing.JMenu();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("AvantFGM");
        displayDrawing.setBackground(new java.awt.Color(51, 51, 51));
        org.jdesktop.layout.GroupLayout displayDrawingLayout = new org.jdesktop.layout.GroupLayout(displayDrawing);
        displayDrawing.setLayout(displayDrawingLayout);
        displayDrawingLayout.setHorizontalGroup(
            displayDrawingLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 351, Short.MAX_VALUE)
        );
        displayDrawingLayout.setVerticalGroup(
            displayDrawingLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 279, Short.MAX_VALUE)
        );

        infoOutput.setBackground(new java.awt.Color(255, 255, 255));
        infoOutput.setBorder(javax.swing.BorderFactory.createTitledBorder(new javax.swing.border.MatteBorder(null), "Info & Output"));
        org.jdesktop.layout.GroupLayout infoOutputLayout = new org.jdesktop.layout.GroupLayout(infoOutput);
        infoOutput.setLayout(infoOutputLayout);
        infoOutputLayout.setHorizontalGroup(
            infoOutputLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 86, Short.MAX_VALUE)
        );
        infoOutputLayout.setVerticalGroup(
            infoOutputLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 128, Short.MAX_VALUE)
        );

        triggerMatrix.setText("Matrix");
        triggerMatrix.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                triggerMatrixActionPerformed(evt);
            }
        });

        triggerInclusion.setText("Inclusion");
        triggerInclusion.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                triggerInclusionActionPerformed(evt);
            }
        });

        startCalculation.setText("Calculate");
        startCalculation.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                startCalculationActionPerformed(evt);
            }
        });

        jMenu1.setText("File");
        jMenuBar1.add(jMenu1);

        jMenu2.setText("Option");
        jMenuBar1.add(jMenu2);

        jMenu3.setText("Help");
        jMenuBar1.add(jMenu3);

        setJMenuBar(jMenuBar1);

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
                .add(displayDrawing, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                    .add(triggerMatrix, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .add(infoOutput, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .add(triggerInclusion, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .add(startCalculation, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .addContainerGap()
                .add(triggerMatrix, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 31, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(triggerInclusion, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 36, Short.MAX_VALUE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(startCalculation, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 31, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(infoOutput, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
            .add(displayDrawing, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        pack();
    }// </editor-fold>                        

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

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

    private void triggerMatrixActionPerformed(java.awt.event.ActionEvent evt) {                                              
//                report2_2();
    }                                             

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

    // Variables declaration - do not modify                     
    private javax.swing.JPanel displayDrawing;
    private javax.swing.JPanel infoOutput;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenu jMenu3;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JToggleButton startCalculation;
    private javax.swing.JToggleButton triggerInclusion;
    private javax.swing.JToggleButton triggerMatrix;
    // End of variables declaration                   

}

dajiebuda do not do double posting! Stick to the original post and do not spread chaos over forum. I told you where you can find information to setup CLASSPATH and you should follow them. Why? Because if the not let you have NetBeans you would not know how to run simple Hello.java program from command line...
Copy and Pate is not solution to learn programming language

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.