Page 1 of 1

EXCEPTION THREAD

Posted: Thu Jul 11, 2002 9:55 pm
by Richard
I am beginning to learning Java and the book I am using gives examples of application code to print to the console to get new student used to java.

The application code is:
'public class PracticeApp{
public static void main(String[] args) {
System.out.println(\"Practice Application\"); }
}
}'

The application is compiling fine using Textpad. When I run the application
from Textpad, I get this error message:
'Exception in thread \"main\" Java, lang.noclass def found error: PracticeApp'

What is causing this problem ?

Re: EXCEPTION THREAD

Posted: Sun Jul 14, 2002 8:41 am
by Adam
First, the code that you actually copied into here will should nto actually compile, it has an extra close bracket at the end.

However, since you said it compiled I will assume that what you have here and what you actually have are a little different. You may want to check to make sure that the directory that the program is using to call the class from is the same directory you are actually in, otherwise you will get an error clsoe to that one. (since the Java Virtual Machine will not be able to find yoru actual compiled class)

The error that you have written there looks slightly different than the error that you would recieve if this was the case. The error you have often comes up when you try to access a class that does not exist. This is usually a case of mispelling, or perhaps an unfortunate use of a capitol or non-capitol letter.

But, minus the extra close bracket, you code should run fine. So, I would go back to the original statement and make sure that Textpad is trying to run your class from the directory that it resides in.

Re: EXCEPTION THREAD

Posted: Mon Jul 15, 2002 3:56 pm
by Andreas
Check your class path.

And in future, use the java-specific forum for java-related questions, please.