getting problem in compiling java program?

C:\PROGRA~1\Java\JDK15~1.0\bin>javac sample.java

C:\PROGRA~1\Java\JDK15~1.0\bin>java sample

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

plse anyone help me? i am getting the above problem, plse send me solutions>>>>>>>>>>>>

[270 byte] By [sandy_frm_oxforda] at [2007-11-27 11:30:44]
# 1

Make sure ur public class is named as sample()

New_Kida at 2007-7-29 16:35:37 > top of Java-index,Java Essentials,New To Java...
# 2

ya it is exactly correct.............

sandy_frm_oxforda at 2007-7-29 16:35:37 > top of Java-index,Java Essentials,New To Java...
# 3

still i am getting same problem gays................

plse send me exact solution...................

sandy_frm_oxforda at 2007-7-29 16:35:37 > top of Java-index,Java Essentials,New To Java...
# 4

In order to give us an idea of what's wrong, please post the java file contents,

using code tags.

lance_dragonsa at 2007-7-29 16:35:37 > top of Java-index,Java Essentials,New To Java...
# 5

class sample

{

public static void main()

{

System.out.println("this is a simple program");

}

}

this is my simple program, and not even this all programs same problems.................

sandy_frm_oxforda at 2007-7-29 16:35:37 > top of Java-index,Java Essentials,New To Java...
# 6

public class sample

and

main(String[] args)

masijade.a at 2007-7-29 16:35:37 > top of Java-index,Java Essentials,New To Java...
# 7

no yar same getting problem, and i think in setting class path problem ?

but i do't know how to set the classpath in environment variables>>>>>>>>

sandy_frm_oxforda at 2007-7-29 16:35:37 > top of Java-index,Java Essentials,New To Java...
# 8

then do

java -cp . sample

Edit: In addition to the other two changes. And ensure that sample.class exists in the current folder after the javac command.

masijade.a at 2007-7-29 16:35:37 > top of Java-index,Java Essentials,New To Java...
# 9

To set the class path in environment variables in Both User variables and System variables tabs give these to values(classpath and path).

variable name : CLASSPATH

variable value : C:\Program Files\Java\jdk1.5.0_05\lib;

and

variable name : PATH

variable value : C:\Program Files\Java\jdk1.5.0_05\bin;

sekhar.allaa at 2007-7-29 16:35:37 > top of Java-index,Java Essentials,New To Java...
# 10

can u tell me what is that "-cp " command, plse gays i am new in java.............

sandy_frm_oxforda at 2007-7-29 16:35:37 > top of Java-index,Java Essentials,New To Java...
# 11

-cp is the "classpath" option

java -cp . sample

"." being current directory, of course.

masijade.a at 2007-7-29 16:35:37 > top of Java-index,Java Essentials,New To Java...
# 12

thanks gays, i got solution for that, sorry for disturbing for my work.................

sandy_frm_oxforda at 2007-7-29 16:35:37 > top of Java-index,Java Essentials,New To Java...
# 13

> plse gays

you say that to everyone in oxford?

OnBringera at 2007-7-29 16:35:37 > top of Java-index,Java Essentials,New To Java...
# 14

Judging from his grasp of the English language I would doubt that he is from Oxford! I'm guessing Brighton lol

PaulOckleforda at 2007-7-29 16:35:37 > top of Java-index,Java Essentials,New To Java...