I get this when I try to load my program, yet the compiler says its fine. Please help!

Exception in thread "main" java.lang.NoClassDefFoundError: PIStudy$DoPolyINTest
at PIStudy.<init>(PIStudy.java:51)
at PIStudy.main(PIStudy.java:121)

import javax.swing.*;
import java.util.Random;
import java.awt.*;
import java.awt.event.*;

public class PIStudy {
   
   public JFrame window;
   public JButton name;
   public JButton comb;
   public JButton ioni;
   public JLabel resultLabel;
   
   public int correct;
   public int problems;
   public String input;
      
   public final String[] PolyIC = {/*stuff*/};
   public final String[] PolyIN = {/*stuff*/};
   public final String[] PolyII = {/*stuff*/};
   
   
   public PIStudy() {
      window = new JFrame();
      window.setTitle("Polyatomic Ion Study Program");
      window.getContentPane().setLayout(new BoxLayout(window.getContentPane(),
            BoxLayout.PAGE_AXIS));
      
      name = new JButton("Test for Name");
      name.addActionListener(new DoPolyINTest());
      window.getContentPane().add(name);
      
      comb = new JButton("Test for Combination");
      comb.addActionListener(new DoPolyICTest());
      window.getContentPane().add(comb);
      
      ioni = new JButton("Test for Ionization");
      ioni.addActionListener(new DoPolyIITest());
      window.getContentPane().add(ioni);
   
      resultLabel = new JLabel("Ready..................................");
      window.getContentPane().add(resultLabel);
      
      window.pack();
   }
      

   class DoPolyICTest implements ActionListener {
      public void actionPerformed(ActionEvent c) {
         Random gen = new Random();
         
         int randNum = gen.nextInt(PolyIC.length + 1);
         input = null; //JOptionPane.showInputDialog(PolyIC[randNum]);
         if (input.equals(PolyIN[randNum])) {
            resultLabel.setText("Correct!");
               correct++; problems++;
         } else {
            resultLabel.setText("Sorry, the correct answer is " +
                  PolyIN[randNum]);
               problems++;
         }
      }
   }
   
   class DoPolyINTest implements ActionListener {
      public void actionPerformed(ActionEvent n) {
         Random gen = new Random();
         
         int randNum = gen.nextInt(PolyIN.length + 1);
         input = null; //JOptionPane.showInputDialog(PolyIN[randNum]);
         if (input.equals(PolyIC[randNum])) {
            resultLabel.setText("Correct!");
            correct++; problems++;
         } else {
            resultLabel.setText("Sorry, the correct answer is " +
                  PolyIC[randNum]);
            problems++;
         }
      }
   }
   
   class DoPolyIITest implements ActionListener {
      public void actionPerformed(ActionEvent e) {
         Random gen = new Random();
         
         int randNum = gen.nextInt(PolyIC.length + 1);
         input = null; //JOptionPane.showInputDialog(PolyIC[randNum]);
         if (input.equals(PolyII[randNum])) {
            resultLabel.setText("Correct!");
            correct++; problems++;
         } else {
            resultLabel.setText("Sorry, the correct answer is " +
                  PolyII[randNum]);
            problems++;
         }
      }
   }
   
   public static void main(String[] args) {
      PIStudy gui = new PIStudy();
      gui.window.addWindowListener(new WindowAdapter()
            {
               public void windowClosing(WindowEvent e) { System.exit(0); }
            });
      gui.window.setVisible(true);
   }
}

I imported your code, and the only errors I received when run is an index out of bounds error, (when I clicked one of the buttons,) but that was because you have no values for;

public final String[] PolyIC = {/*stuff*/};
public final String[] PolyIN = {/*stuff*/};
public final String[] PolyII = {/*stuff*/};

So I added some values to the index's above, but then I get a Null Pointer Exception at:

input = null; //JOptionPane.showInputDialog(PolyIC[randNum]);
if (input.equals(PolyIN[randNum])) {

But that is because you assigned null to input.

Is this the same code you ran against?
Note this happend when I clicked on any of the buttons on the dialog, but they were all specific to the method invoked.

oops. I was experimenting with that null. um.. what was in the comments is what is supposed to be there. sorry *smacks self in head*

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.