Calss path problem

Hi All,

I had installed J2SE 5.0. I had Set the PATH to J2SE 5.0 Directory. When ever I execute the following

c:\>javac MyProg.class

it gives error

Exception in thread "main" java.lang.NoClassDefFoundError: MyProg/class

Please help me why this error is coming and how can i rectify it.

[332 byte] By [Rajesh6477] at [2007-11-25 18:46:54]
# 1
javac is the java compiler, it understands .java source files.To run the class file:java MyprogNOTE leave off the .class extension.
b.nitz at 2007-7-3 21:35:08 > top of Java-index,Desktop,Sun Java Desktop System...
# 2
even after doing what you had said stillit gives the same problem. Help me
Rajesh6477 at 2007-7-3 21:35:08 > top of Java-index,Desktop,Sun Java Desktop System...
# 3

Try reposting in this forum:

http://forum.java.sun.com/category.jspa?categoryID=5

Here are a few questions that people in the Java forum may ask:

1) Is the file containing class MyProg named MyProg.java? (javac is case sensitive, it and expects the file to be named {something}.java)

2) Is the class MyProg public?

3) Does the class MyProg contain a public method main?

4) Does the program work properly in Java 1.4?

It may be helpful to post the exact commands you're typing, the first page of the source code containing main.

b.nitz at 2007-7-3 21:35:08 > top of Java-index,Desktop,Sun Java Desktop System...
# 4
the code <<javac name.java>> produces<<name.class>> <<java name>> can implement the javacode
bearnn at 2007-7-3 21:35:08 > top of Java-index,Desktop,Sun Java Desktop System...
# 5
java -classpath %CLASSPATH%;. MyProg
gogyStar at 2007-7-3 21:35:08 > top of Java-index,Desktop,Sun Java Desktop System...
# 6
as mentioned above run this with classpath pointing to your current working directory or set the classpath as:classpath = %classpath%;.(pls note there is dot . following the semicolon)
tejr at 2007-7-3 21:35:08 > top of Java-index,Desktop,Sun Java Desktop System...
# 7
I had this same problem. Do you have an IPOD that you recently updated the software?
Focal at 2007-7-3 21:35:08 > top of Java-index,Desktop,Sun Java Desktop System...
# 8
how to rectify the runtime exception of NoClassDefFoundError in java while running a java program
good_girl at 2007-7-3 21:35:08 > top of Java-index,Desktop,Sun Java Desktop System...