How to set java environment variables on Windows

How to set java environment variables JAVA_HOME and path on Windows 7 / Vista.

Setting JAVA_HOME and Java path is very easy. First you must locate your JDK, which is usually on C drive, Program Files, Java, JDK.

Next copy this path

Right click your computer, properties. Choose Advanced system settings. Click on environment variables and here you should have system variables.

First we'll set JAVA_HOME. It's a variable, that should point to JDK home directory. This variable is needed for many Java applications.

Click new, type variable name JAVA_HOME and paste into variable value location to JDK.

Next we'll add java executable files to path

Copy path to bin directory in JDK, click on the Path system variable. Now this is very important: type semicolon and paste path to bin directory of JDK.

Now you must restart your computer.

EDIT: You don't have to restart your computer, but any command line you have currently open.