กก

        (for Windows NT/2000/XP)

1. At the left bottom corner of your computer desktop, choose Start -> Setting -> Control Panel, and double-click System

2. On Microsoft Windows NT, select the Environment tab; on Microsoft Windows 
2000/XP select the Advanced tab and then Environment Variables.

3. For either User variables or System variables, click New and in the popup window, enter Variable name as CLASSPATH (note that all letters should be capital), and the directory where your JSDK is installed as the Variable value.

For example:

If your JSDK is installed at: C:\j2sdk1.4.1_06

Put the following line as the value:

C:\j2sdk1.4.1_06\bin;C:\j2sdk1.4.1_06\jre\bin;.

The first is where the java compiler 'javac' is, the second is the java run time environment 'java' is, and the final '.' denotes your working directory, so that the compiler and jre will find where your programs are.  To be safe, you may also want to append the above line to then end of your PATH variable. Use ';' as the separator.

Save the variables, test the setting by opening a DOS prompt, type in

echo %CLASSPATH%

If your environment variables are set correctly, you should see your settings.

Or, you can just type in 

javac

java

If your PATH and CLASSPATH is correct, windows should recognize those commands.

You do NOT need to restart your computer when installing Java.