Problem in running my first sample program

I made this simple program from the book Teach Yourself Java 2:

publicclass HelloUser{

publicstaticvoid main (String[] arguments){

String username = System.getProperty("user.name");

System.out.println("Hello, " + username);

}

}

Now my problem is when I use the command line to compile my program, it displays no error. But when I run it this message appears:

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

I have set the ClassPath variable and the Path as well. Both the .java and .class files are in the same folder. But when I used JCreator, I was able to view the output in the output window.

Anyone knows why I can't see the results in the command prompt window? It really puzzles me.

[1128 byte] By [GarnetGirla] at [2007-11-27 2:27:56]
# 1
java -cp . HelloUser
Michael.Nazarov@sun.coma at 2007-7-12 2:39:17 > top of Java-index,Java Essentials,New To Java...
# 2
hmmm... I received the same message.
GarnetGirla at 2007-7-12 2:39:17 > top of Java-index,Java Essentials,New To Java...
# 3
Show output of "dir" or "ls" command.
Michael.Nazarov@sun.coma at 2007-7-12 2:39:17 > top of Java-index,Java Essentials,New To Java...
# 4
> Show output of "dir" or "ls" command.HelloUser.javaHelloUser.class
GarnetGirla at 2007-7-12 2:39:17 > top of Java-index,Java Essentials,New To Java...
# 5

Ok, run again dir, javac, dir and java commands and send complete copy of output using copy of terminal, not few words by manual retyping.

It should be something like:

C:\Work\o\Hello>dir

Volume in drive C is XX

Volume Serial Number is XXXX-XXXX

Directory of C:\Work\o\Hello

26.04.2007 17:52<DIR> .

26.04.2007 17:52<DIR> ..

26.04.2007 17:50181 HelloUser.java

1 File(s)181 bytes

2 Dir(s) 12 005 871 616 bytes free

C:\Work\o\Hello>javac HelloUser.java

C:\Work\o\Hello>dir

Volume in drive C is XX

Volume Serial Number is XXXX-XXXX

Directory of C:\Work\o\Hello

26.04.2007 17:52<DIR> .

26.04.2007 17:52<DIR> ..

26.04.2007 17:52671 HelloUser.class

26.04.2007 17:50181 HelloUser.java

2 File(s)852 bytes

2 Dir(s) 12 005 867 520 bytes free

C:\Work\o\Hello>java -cp . HelloUser

Hello, XXX

C:\Work\o\Hello>

Michael.Nazarov@sun.coma at 2007-7-12 2:39:17 > top of Java-index,Java Essentials,New To Java...
# 6
javac -cp . HelloUser.javajava -cp . HelloUsertype HelloUser.javaDoes the class inside any package ?
rym82a at 2007-7-12 2:39:17 > top of Java-index,Java Essentials,New To Java...
# 7
post the compile command you used plz
java_2006a at 2007-7-12 2:39:17 > top of Java-index,Java Essentials,New To Java...