EXCEPTION IN THREAD

Using the Java SDK with TextPad

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

Post Reply
Richard

EXCEPTION IN THREAD

Post 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 ?
Jim Garacci

Re: EXCEPTION IN THREAD

Post by Jim Garacci »

Typically, this is due to the CLASSPATH not being set properly. Java relies on the CLASSPATH environment variable, or command line option -cp, to locate classes for loading in to the Java virtual machine (JVM). If they are not on the classpath, they do not get loaded, and you get the infamous "no class def found" error.

Side-note: I never run apps through TextPad. I run via prompt, usually utilizing one or more scripts, .pl, .bat, .sh to establish the environment and invoke the VM. Why? One can never be too sure how things will run under TextPad in your environment. For example, running Java with nortons anti-virus under win98 freezes the run process.

If desired, I can provide examples of the scripts that I utilize as well as instructions for setting up TextPad commands to invoke them.

-Jim
Post Reply