Make sure that you name the java file itself the same that you name you java file, i.e. "HelloWorld.java" and "public class HelloWorld" etc...(and this is case sensitive). After you write your java file, open a command prompt and navigate to the folder that you saved the java file in, i.e. "C:\My Homework\Java\". Then when you're in the same folder as your java file, compile it with "javac", i.e. "javac HelloWorld.java". This will create a class file in the same folder for you, i.e. "HelloWorld.class". Then all you have to do is call the file with the "java" command, i.e. "java HelloWorld"(no file extensions on this one). That's about it, hope this helps.

p.s. Depending on how you set up your classpaths, if the command prompt says that it doesn't recognize the "javac" command, you might have to implicitly say where the "javac" command lives. That's why most people set up their classpaths so that they can call the "java" and "javac" commands from anywhere.