Exception in thread "main" java.lang.NoClassDefFoundError: app

Hello! I loaded j2sdk_1.4.2_04 onto may machine and I wanted to test a simple hello program below.

// Hello Pogram

public class app

{

public static void main(String[] args)

{

System.out.println("Hello from Java!");

}

}

// End of Hello Program

When I run it by typeing

java app (note the file name is app.java)

I get the error "Exception in thread "main" java.lang.NoClassDefFoundError: app"

I checked various support pages and they mentioned the classpath not being set. So, I tried setting the class path to c:\j2sdk_1.4.2_04\bin;.;c:\j2sdk_1.4.2_04\lib but I still couldn't resolve the problem. I have the app.java in the c:\j2sdk_1.4.2_04\bin and this is also where I am running the java app command.

Thanks for your help,

david fish (beginner)

[853 byte] By [defish102769] at [2007-9-30 5:58:32]
# 1

Did you first compile it by using

javac filename.java

then

run as

java filename

This error come when the class file generated is not found.

so first copile and execute it.

If it is already done then check the class path at the place where you are compiling just type javac

that should display you with the set of options that can be used with javac ..

if it is not there then set your classpath to j2sdk...\bin

All The BEst.

ShivaKatula at 2007-7-1 19:20:55 > top of Java-index,Administration Tools,Sun Connection...
# 2

Hello! Thank you, Thank You! I haven't worked on Java for years and according to the book I was reading "Java 2 Black Book", it did not mention that I needed to compile it. It tells the user just to type java app and it should run. Should the Java command work without compiling the program?

Thanks,

David

defish102769 at 2007-7-1 19:20:55 > top of Java-index,Administration Tools,Sun Connection...