user3485794
user3485794

Reputation: 25

Java Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - Erroneous tree type:

I am receiving a Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - Erroneous tree type: error in netbeans when I try to run the code below. I am supposed to input from a file and then display the data using the formulas below in the output window. I don't see any errors that are given with the code itself until I try to run the code. I am new to Java and having a hard time grasping some of the concepts. I have cleared out the netbeans cache and restarted and now am getting this error. Thanks for any help.

 package input.from.a.file.broc.east;

 public class InputFromAFileBrocEast
    {
     public static void main(String[] args)
     {
      String name;
      int hours;
      int rate;
      int grossPay;      

      InputFile wageFile;        
      wageFile = new InputFile("payroll.txt");

      while (!wageFile.eof())
      {
        name = wageFile.readString();
        hours = wageFile.readInt();
        rate = wageFile.readInt();

      if (hours <= 40)
      {
       grossPay = (rate * hours); 
       System.out.println("grossPay");
      }

      else
       {
       grossPay = (int) ((rate * 40) + (hours-40) * 1.5 * rate);
       System.out.println("Gross Pay: " + grossPay);
       }


       }

    } 

 }

Upvotes: 0

Views: 9802

Answers (1)

Balwinder Singh
Balwinder Singh

Reputation: 2282

Netbeans allows you to run the code even if certain classes are not compilable. During the application's runtime, if you access this class it would lead to this exception.

To ensure you get the exact compilation error, you need to deselect 'Compile On Save' in the project options.

Also have a look at https://netbeans.org/bugzilla/show_bug.cgi?id=199293

Upvotes: 1

Related Questions