0

I am getting an error when trying to run my code in Java. I am trying to run an output to a file where the user uses dialog boxes to input name, pay rate, and hours worked.

This is the code I have:

package output.to.a.file.broc.east;

import javax.swing.JOptionPane;

public class OutputToAFileBrocEast
{

    public static void main(String[] args)
    {
        OutputFile payFile;
        payFile = new OutputFile ("payroll.txt");
        String name; 
        String rate;
        String hours;
        String answer;

        do
        {
            int number1;
            int number2;
            name = JOptionPane.showInputDialog("Enter first and last name: ");
            rate = JOptionPane.showInputDialog("Enter hourly rate: ");
            hours = JOptionPane.showInputDialog("Enter hours for previous week: ");

            number1 = Integer.parseInt (rate); 
            number2 = Integer.parseInt (hours); 

            payFile.writeWord(name);
            payFile.writeWord(rate);
            payFile.writeWord(hours);
            payFile.writeEOL();

            answer = JOptionPane.showInputDialog("Do you have another employee? [y/n");
        }

        while (answer.equalsIgnoreCase ("yes"));

    }

}

But I get this error when trying to run the code:

Error: Could not find or load main class output.to.a.file.broc.east.OutputToAFileBrocEast
Java Result: 1

I am using Netbeans 7.4. and I have already attempted to delete the netbeans cache.

halfer
  • 19,824
  • 17
  • 99
  • 186
user3485794
  • 25
  • 3
  • 8

1 Answers1

0

If you build a jar, open it with 7zip or so, and you should find:

/output/to/a/file/broc/east/OutputToAFileBrocEast.class

The same when the same holds without jar: in the dist or target folder under classes.

Maybe you have an extra directory or such.

Joop Eggen
  • 107,315
  • 7
  • 83
  • 138