error message "Exception in thread "main"

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
S Jones

error message "Exception in thread "main"

Post by S Jones »

While working on Assignment 2-1 in Murach's beggining Java2, I came across a problem. I managed to get a good compile but when I run it I get a run time error. Following is my code and the error message.

public class PracticeApp{
public static void main(String[] args){
int quantity = 3;
double price = 24.95;
float floatNumber = 24.95e+15F;
char character = 75;
boolean valid = true;
System.out.println("Quantity = " + quantity);
System.out.println("Price = " + price);
System.out.println("FP Number = " + floatNumber);
System.out.println("Char = " + character);
System.out.println("Valid = " + valid);
}
}

Exception in thread "main" java.lang.NoClassDefFoundError: PracticeApp
Press any key to continue

P.S. This also happened in the first assignment I tried but I thought perhaps that that program was not supposed to actually run
Andreas

Re: error message "Exception in thread "main"

Post by Andreas »

Your CLASSPATH is not set correctly, it should probably contain the . (dot) folder (. = current folder)
Post Reply