Error: Exception in thread

Hi All,

I am a new member on this forum. I am trying to learn java. I wrote my first java program and finding difficulty in execution of the same.

The program is a simple 'Hello World' program. I am using J2sdk1.4.2_06 and failing to run the java program using the command prompt on Windows XP Professional.

My code is:

class myfirstjavaprogram

{

public static void main(String args[])

{

System.out.println("Hello World");

}

}

I was able to compile the program successfully but got an error when tried to run the program.

Error that I got is:

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

Any and all help with this regards is highly appreciated.

Thanks & Regards,

Priti

[812 byte] By [priti07a] at [2007-10-3 9:12:14]
# 1
set classpath=%classpath%;.note :-put (.) dot symbol at last in the line
harishotya at 2007-7-15 4:24:28 > top of Java-index,Java Essentials,New To Java...
# 2
Did you save your file correctly "myfirstjavaprogram.java" . Your file name should be your calssname and once again check the classpath. In my system is working correctly.
ggopia at 2007-7-15 4:24:28 > top of Java-index,Java Essentials,New To Java...
# 3
> set classpath=%classpath%;.> > note :-> > put (.) dot symbol at last in the line-your suppose to say this line know..set classpath=.
ggopia at 2007-7-15 4:24:28 > top of Java-index,Java Essentials,New To Java...
# 4

I am also new to java, last time I have this error was I incorrectly install JAVA SDK. but the problem solved when I reinstall sdk and jre. I think the original classpath is not correct, so java cannot found the related class , perhaps I have 2 version of sdk and got the path messed up.

your code is ok I think.

Jack_tta at 2007-7-15 4:24:28 > top of Java-index,Java Essentials,New To Java...
# 5
> your suppose to say this line know..> set classpath=.This will set the classpath as the current directory. Then what about the classpath that have already been set ?
harishotya at 2007-7-15 4:24:28 > top of Java-index,Java Essentials,New To Java...
# 6
> This will set the classpath as the current directory.> Then what about the classpath that have already been> set ?That will be override for the current class path?
ggopia at 2007-7-15 4:24:28 > top of Java-index,Java Essentials,New To Java...
# 7

Hi,

Can someone please tell me if I am doing something wrong in setting the classpath, stated below. I changed the classpath by right-clicking the 'My Computer' icon on my desktop.

From the 'Properties' dialog box, I clicked on 'Advance' tab and selected 'Environment Variables' button. I changed the classpath to

%C:\j2sdk1.4.2_06\bin%;.

Am I doing anything wrong?

Regards,

Priti

priti07a at 2007-7-15 4:24:28 > top of Java-index,Java Essentials,New To Java...
# 8

Hi

MyComputer ->right click-select -properties-select advanced

in path option mention: C:\j2sdk1.4.2_06\bin;

in Classpath option mention :C:\j2sdk1.4.2_06\lib;.;

this (;.; ) can indicates to JVM current directory is working area..

thanks&regards

naveen.m

java_marthona at 2007-7-15 4:24:28 > top of Java-index,Java Essentials,New To Java...