The two most commonly used environment variables are PATH and CLASSPATH
When you code in java, you want do do at least 2 things: Compile the code and Run the code
COMPILING THE CODE
when you type "javac", it looks up your PATH variable to try to find where (in what folder) javac.exe is located. So if your javac.exe file is in "c:\Program Files\j2sdk1.5\javac.exe" and your PATH variable isn't defined as a System variable, then you'll have to type the whole "c:\Program Files\j2sdk1.5\javac.exe MyClass.java".
java, javac, jar and a whole bunch of others are typically looked up using the PATH variable.
RUNNING THE APP
when in the command prompt you type "java MyClass", it will look for the PATH to find "java.exe" and then it'll look in the CLASSPATH to find MyClass.class
If CLASSPATH is not defined, then you'll have to type it in the command line using the -cp argument or it won't know where to find the class and give you a big NoClassDefinedError (At leas I think thats what the error is)
Hope this helps