Error Message when running first java program

Hi,

I am reading "Sams Teach Yourself Java 6 in 21 Days" by Rogers Cadenhead. I am having a problem with compiling the sample program in the first part of the book, "HelloUser" which is supposed to print out "Hello (my name - Matt)" when run in the command line.

I receive this error when trying to run it after having successfully compiled it (I enter java HelloUser while in correct folder):

Exception in thread "main" java.lang.NoSuchMethodError: main

I have correctly set the PATH and CLASSPATH settings for my PC (Windows XP). I am guessing that I need to define a "main" or something. I'm brand new to Java but am good with the scripting language PHP. Please tell me what I should do to correct this problem. Thanks in advance

[764 byte] By [Sierra_Doga] at [2007-11-27 10:38:20]
# 1

Hey Sierra Dog / Matt and welcome here. Why don't you post your code so we can see it. Please use code tags if you do. See this site to learn more about code tags:

http://forum.java.sun.com/help.jspa?sec=formatting

petes1234a at 2007-7-28 18:53:47 > top of Java-index,Java Essentials,New To Java...
# 2

Also, double check that you have a method called main (note that this has to be all in lower-case). It should look exactly like the method in the book. So remember precision is critical as the compiler is unforgiving. Case and spelling matter.

Good luck!

petes1234a at 2007-7-28 18:53:47 > top of Java-index,Java Essentials,New To Java...
# 3

Here is the code for the program:

public class HelloUser {

public static void man(String[] arguments) {

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

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

}

}

Here is what I enter in the Command Line:

cd \JavaWork\j21work

javac HelloUser.java

java HelloUser

There are no problems up until I enter the last line (java HelloUser) to run the program. By the way, I using JDK 6 update 1 with Windows XP.

Sierra_Doga at 2007-7-28 18:53:47 > top of Java-index,Java Essentials,New To Java...
# 4

The code posted above is letter for letter (even caps) for what is in the book. It's only 6 lines, extremely simple sample. Nothing in the book about declaring a "main" though.

Sierra_Doga at 2007-7-28 18:53:47 > top of Java-index,Java Essentials,New To Java...
# 5

Wow, I feel like an idiot. I was rereading my post and found I forgot the "i" in main. I corrected it and go the program to run fine. Thanks alot for your time petes

Sierra_Doga at 2007-7-28 18:53:47 > top of Java-index,Java Essentials,New To Java...
# 6

No problem, but I didn't do anything. You had the best result here that you can expect: you found the error yourself and then corrected it yourself. There's no better way to learn than this. Because of this, I can guarantee that this error will never happen to you again.

Good luck with your coding!

petes1234a at 2007-7-28 18:53:47 > top of Java-index,Java Essentials,New To Java...