In Windows 7:
Control Panel->System->advanced system settings->environment variables->system variables:
Create new variables:
->click new
variable name: CLASSPATH, variable value: C:\Program Files\Java\jdk1.6.0_22
variable name: JAVA_HOME, variable value: C:\Program Files\Java\jdk1.6.0_22
variable name: Path, variable value: ...;...;C:\Program Files\Java\jdk1.6.0_22\bin; (append it to the existing path, don't forget the semi-columns(;))