Hello I am running into an error after creating the jar file. I get a message stating that the main class to my program could not be found when in fact there is a main class.

If someone could give me a hand and lead me in the right direction on how to tackle this problem, it will be greatly appreciated.
Thanks.

This is my main program file:

public class MainProgram{
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(Frame_Layout.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(Frame_Layout.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(Frame_Layout.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(Frame_Layout.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 Frame_Layout().setVisible(true);
            }
        });
    }
}

This is my frame layout class:

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JOptionPane;

/**
 *
 * @author Rodrigo Tellez
 */
@SuppressWarnings("serial")
public class Frame_Layout extends javax.swing.JFrame {

    /**
     * Creates new form Frame_Layout
     */

    private int statusNum=0;
    private int nSubClicks=0;
    private List<String> gradeList = new ArrayList<String>();
    private List<String> unitList = new ArrayList<String>();

    public Frame_Layout() {
        initComponents();
        jTextArea1.setEditable(false);
    }

    /**
     * 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", "rawtypes" })
    // <editor-fold defaultstate="collapsed" desc="Generated Code">
    private void initComponents() {

        menuBar1 = new java.awt.MenuBar();
        menu1 = new java.awt.Menu();
        menu2 = new java.awt.Menu();
        menuBar2 = new java.awt.MenuBar();
        menu3 = new java.awt.Menu();
        menu4 = new java.awt.Menu();
        menuBar3 = new java.awt.MenuBar();
        menu5 = new java.awt.Menu();
        menu6 = new java.awt.Menu();
        popupMenu1 = new java.awt.PopupMenu();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jComboBox1 = new javax.swing.JComboBox();
        jCheckBox1 = new javax.swing.JCheckBox();
        jLabel4 = new javax.swing.JLabel();
        jTextField1 = new javax.swing.JTextField();
        jTextField2 = new javax.swing.JTextField();
        jTextField3 = new javax.swing.JTextField();
        jTextField4 = new javax.swing.JTextField();
        jButton1 = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        jList1 = new javax.swing.JList();
        jScrollPane2 = new javax.swing.JScrollPane();
        jTextArea1 = new javax.swing.JTextArea();
        jButton2 = new javax.swing.JButton();
        jButton3 = new javax.swing.JButton();
        jLabel5 = new javax.swing.JLabel();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jSeparator3 = new javax.swing.JPopupMenu.Separator();
        jMenuItem4 = new javax.swing.JMenuItem();
        jMenuItem1 = new javax.swing.JMenuItem();
        jMenuItem3 = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        jSeparator2 = new javax.swing.JPopupMenu.Separator();
        jMenuItem2 = new javax.swing.JMenuItem();

        menu1.setLabel("File");
        menuBar1.add(menu1);

        menu2.setLabel("Edit");
        menuBar1.add(menu2);

        menu3.setLabel("File");
        menuBar2.add(menu3);

        menu4.setLabel("Edit");
        menuBar2.add(menu4);

        menu5.setLabel("File");
        menuBar3.add(menu5);

        menu6.setLabel("Edit");
        menuBar3.add(menu6);

        popupMenu1.setLabel("popupMenu1");

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("SJDC GPA Calculator");

        jLabel1.setText("Class Name:");

        jLabel2.setText("Grade:");

        jLabel3.setText("Units:");

        jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Semester 1", "Semester 2", "Semester 3", "Semester 4", "Semester 5", "Semester 6", "Semester 7" }));

        jCheckBox1.setText("Summer:");

        jLabel4.setText("Year:");

        jTextField1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextField1ActionPerformed(evt);
            }
        });

        jTextField2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jTextField2MouseClicked(evt);
            }
        });

        jButton1.setText("Submit:");
        jButton1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jButton1MouseClicked(evt);
            }
        });
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jList1.setModel(new javax.swing.AbstractListModel() {
            String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        jScrollPane1.setViewportView(jList1);

        jTextArea1.setColumns(20);
        jTextArea1.setRows(5);
        jScrollPane2.setViewportView(jTextArea1);

        jButton2.setText("Clear Input:");
        jButton2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jButton2MouseClicked(evt);
            }
        });

        jButton3.setText("Change Semester");
        jButton3.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jButton3MouseClicked(evt);
            }
        });
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });

        jLabel5.setText("Developed by: Rodrigo Tellez");

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

        jMenuItem4.setText("Open");
        jMenu1.add(jMenuItem4);

        jMenuItem1.setText("Save");
        jMenu1.add(jMenuItem1);

        jMenuItem3.setText("Close");
        jMenu1.add(jMenuItem3);

        jMenuBar1.add(jMenu1);

        jMenu2.setText("Edit");
        jMenu2.add(jSeparator2);

        jMenuItem2.setText("Clear");
        jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem2ActionPerformed(evt);
            }
        });
        jMenu2.add(jMenuItem2);

        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)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(jLabel2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jLabel1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jLabel4, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jComboBox1, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addGap(24, 24, 24)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jCheckBox1)
                            .addComponent(jTextField1)
                            .addComponent(jTextField2)
                            .addComponent(jTextField3)
                            .addComponent(jTextField4))
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jButton3)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 376, Short.MAX_VALUE)
                                .addComponent(jButton2))
                            .addComponent(jScrollPane2)))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jLabel5)
                        .addGap(205, 205, 205)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 233, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jButton2)
                            .addComponent(jButton3))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jLabel5))
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jCheckBox1))
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel4)
                            .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addComponent(jButton1)
                        .addGap(76, 76, 76))))
        );

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

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

    private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {                                           
        // TODO add your handling code here:
        //jTextField1.setText(null);
        jTextField2.setText(null);
        jTextField3.setText(null);
        jTextField4.setText(null);
        //jCheckBox1.setSelected(false);        
    }                                          
//submit button
    private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {                                      
  //this is the submit button
        if(     statusNum==0  &&
               (jTextField1.getText()!=null && !"".equals(jTextField1.getText()))   &&
               (jTextField2.getText()!=null && !"".equals(jTextField2.getText()))   &&
               (jTextField3.getText()!=null && !"".equals(jTextField3.getText()))   &&
               (jTextField4.getText()!=null && !"".equals(jTextField4.getText()))
          ){
                String year        = jTextField1.getText();
                String className   = jTextField2.getText();
                String grade       = jTextField3.getText();
                String units       = jTextField4.getText();
                String semester    = (String)jComboBox1.getSelectedItem();
                String summer      = (jCheckBox1.isSelected()==true)?"true":"false";

                jTextArea1.append("Year: "+year+"\t"+semester+"\t"+"Summer = "+summer  +
                                  "\nClass Name:\tGrade:\tUnits:"+
                                  "\n"+className+"\t"+grade+"\t"+units+"\n");
                jTextField1.setEditable(false);
                jComboBox1.setEnabled(false);
                jCheckBox1.setEnabled(false);
                jMenuItem2.doClick();
         gradeList.add(grade); 
         unitList.add(units);
         statusNum+=1;
         nSubClicks+=1;
        }
        else if(    statusNum>0  &&
               (jTextField1.getText()!=null && !"".equals(jTextField1.getText()))   &&
               (jTextField2.getText()!=null && !"".equals(jTextField2.getText()))   &&
               (jTextField3.getText()!=null && !"".equals(jTextField3.getText()))   &&
               (jTextField4.getText()!=null && !"".equals(jTextField4.getText()))
          ){
                //jTextField1.setEditable(false);
                String className   = jTextField2.getText();
                String grade       = jTextField3.getText();
                String units       = jTextField4.getText();
                //jComboBox1.setEditable(false);

                jTextArea1.append(className+"\t"+grade+"\t"+units+"\n");
                jMenuItem2.doClick();
         gradeList.add(grade); 
         unitList.add(units);
         statusNum+=1;
         nSubClicks+=1;
        }

        else{
            JOptionPane.showMessageDialog(null,"All fields must be filled:");
        }
    }                                     
//clear input button
    private void jButton2MouseClicked(java.awt.event.MouseEvent evt) {                                      
        jTextArea1.setText(null);
        jMenuItem2.doClick();
        jTextField1.setText(null);
        jTextField2.setText(null);
        jTextField1.setEditable(true);
        jComboBox1.setEnabled(true); 
        jCheckBox1.setEnabled(true);

        statusNum=0;
        nSubClicks=0;

        gradeList.clear();
        unitList.clear();
    }                                     

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

    }                                        
//change semester button
    private void jButton3MouseClicked(java.awt.event.MouseEvent evt) {                                      
        jMenuItem2.doClick();
        jTextField1.setText(null);
        jTextField2.setText(null);
        jTextField1.setEditable(true);
        jComboBox1.setEnabled(true); 
        jCheckBox1.setEnabled(true);
        statusNum  = 0;
        nSubClicks = 0;
        showGPA();
        gradeList.clear();
        unitList.clear();
        //set all fields editable
    }                                     

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

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
        // TODO add your handling code here:
    }
    //Custom Methods - Start
    ////////////////////////
    public void showGPA(){
        double gtoN[] = new double[gradeList.size()];
        double u[]    = new double[unitList.size()];
        String intermediate[] = unitList.toArray(new String[unitList.size()]);
        DecimalFormat f = new DecimalFormat("#.00");
        for(int i = 0;i<gradeList.size();i++){
            if(gradeList.get(i).equalsIgnoreCase("a"))
                gtoN[i] = 4;
            else if(gradeList.get(i).equalsIgnoreCase("b"))
                gtoN[i] = 3;
            else if(gradeList.get(i).equalsIgnoreCase("c"))
                gtoN[i] = 2;
            else if(gradeList.get(i).equalsIgnoreCase("d"))
                gtoN[i] = 1;
            else if(gradeList.get(i).equalsIgnoreCase("e"))
                gtoN[i] = 0;
        }

        for(int j = 0;j<unitList.size();j++){
            u[j] = Double.parseDouble(intermediate[j]);    
        }
        jTextArea1.append("\n\n\tGPA: "+f.format(calcGPA(gtoN,u,gtoN.length))+"\n");
    }
    public double calcGPA(double g[],double u[],int size){
        double totalU=0.0,TOTAL=0.0;
        double totalP[] = new double[size];
        for(int i=0;i<size;i++){
            totalP[i] = (g[i]*u[i]);
        }
        for(double x:u)
            totalU+=x;
        for(double y: totalP)
            TOTAL+=y;
        return TOTAL/totalU;
    }
    ////////////////////////
    //End

    // Variables declaration - do not modify
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JCheckBox jCheckBox1;
    @SuppressWarnings("rawtypes")
    private javax.swing.JComboBox jComboBox1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    @SuppressWarnings("rawtypes")
    private javax.swing.JList jList1;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JMenuItem jMenuItem3;
    private javax.swing.JMenuItem jMenuItem4;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JPopupMenu.Separator jSeparator2;
    private javax.swing.JPopupMenu.Separator jSeparator3;
    private javax.swing.JTextArea jTextArea1;
    private javax.swing.JTextField jTextField1;
    private javax.swing.JTextField jTextField2;
    private javax.swing.JTextField jTextField3;
    private javax.swing.JTextField jTextField4;
    private java.awt.Menu menu1;
    private java.awt.Menu menu2;
    private java.awt.Menu menu3;
    private java.awt.Menu menu4;
    private java.awt.Menu menu5;
    private java.awt.Menu menu6;
    private java.awt.MenuBar menuBar1;
    private java.awt.MenuBar menuBar2;
    private java.awt.MenuBar menuBar3;
    private java.awt.PopupMenu popupMenu1;
    // End of variables declaration
}

Do you have idea of creating manifest file?

Hello Majestics, thanks for the reply.

How would i be able to create the manifest file?

thanks again.

I can run my jar file through command line however, how can i have the jar file run independently of the command line. That is, when a user double clicks the jar file my program will be displayed rather then showing the error message i stated in my first message.

Thats what is pointed in this link... You need a manifest file.
1) Create a text file name manifest
2) write -> Main Class: your mainclass name where your main function resides
3)goto cmd and write jar -cvfm manifest.txt yourjarname.jar yourclasses.class

I atleast earn a point for this... :)

does "yourclasses.class" mean to include all my classes files? I keep getting an error saying that my manifest file might be corrupt, so im guessing im just not entering something in correctly.

Thanks

to include all my classes files

Use a * wildcard to include all your class files: *.class

That would not cause a problem with the manifest file. Make sure the last line in the manifest file ends with a newline character.

i have changed my directory in my command prompt to where all my filles are located that is my classes, jar file, and manifest.txt.

I then ran the following:
java -jar -cvfm manifest.txt GPA_Calculator.jar Frame_Layout*.class

i made sure to leave a carriage return on my manifest.txt file where i have put the following:
Main-Class: Frame_Layout

However, when entering the command from above in the cmd prompt i get the following error still:
Invalid or corrupt jarfile manifest.txt

Any ideas what i could be doing wrong here?

Can you post your exact complete manifest file here?

Open the jar file in a zip utility and look at the contents of the manifest file. It should be in the meta-inf folder.

Did you look in the jar file with a zip utility?

@NormR1:
yes i found the manifest file that im assuming NetBeans created when i exported my project. Should i be using the manifest file found in the jar archive to be able to run my jar just by double clicking on it rather then using command line?

Did the manifest file in the jar file have the correct contents and was it in the correct folder?

I thought that you were creating the jar file from the command line with your manifest file. Where does the IDE get involved?

There needs to be one correctly formatted manifest file in a jar file to be able to have the java program's -jar option open and execute the jar file. Normally double clicking on a jar file uses the java -jar option.

@NormR1
Well my original question was on how i could run my jar application as a regular program, that is just by double clicking the jar it would run. I wrote my source code using an ide which in this case was NetBeans. I am able to run the jar through commandline by using java -jar nameofJar.jar and it works fine. My question was just on how i would be able to bypass using the commandline everytime and just be able to double click the jar in order to start

am able to run the jar through commandline by using java -jar nameofJar.jar and it works fine

That means that the manifest file in the jar file is ok. The problem is somewhere else. The OS has a table of commands associated with file extensions. The problem could be there.

Do you have two versions of java on your PC? One 1.7 and one 1.6? Did you create the class files in the jar file with 1.7 and are trying to execute it with version 1.6?

i have java(TM) 6 update 31 and java(TM) 7 update 3
so i would have the 1.7 and 1.6 on my PC.

Do you suggest that i uninstall the 1.6 version?

Or compile the code with version 1.6

If you uninstall 1.6, would that leave you without an OS entry for executing jar files?

How can i compile my program using only version 1.6?

Use the javac command from the bin folder for the JDK 1.6 files.
With the 1.7 version, use the javac command line options to have it create version 1.6 class files.

Use the javac command from the bin folder for the JDK 1.6 files.
With the 1.7 version, use the javac command line options to have it create version 1.6 class files.

success! thanks for all your help NormR1! I have tested my program on multiple computers and operating systems and it is working like a charm!

Thanks again!

A lot of people have been having that mixed versions problem. The java program sort of hides what the problem is.

so if i were to compile using 1.6 jdk and run using 1.7 jre would this work? Meaning are the JRE's backword compatible as long as the jdk was built using the the same or less then version of jdk?

jre 1.7 should be able to execute class files compiled with jdk 1.6 and earlier

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.