Note: it must be public, static, void, the name must be 'main' and it must have a String array as a parameter.
2: "...and noclassdeffound exception is thrown"
You have to use the "-cp ..." also when you run the program, not just when you compile the program. Make sure the directory that contains the class file is included in the classpath. [ April 19, 2007: Message edited by: Jesper Young ]
I might be totally wrong, and I can't test it right at the moment, but I've seen this happen when you type in the file extension at the command line. Like, if you type "java codeToRun.class" it gives you that error, but if you just type "java codeToRun" it should work fine... I think that's what happened in my case.