Many of us have discovered that when we install the Java Development Kit from
the textbook, the Java Compiler (javac) cannot be found.
This is because the directory that contains the Java compiler is not in the
list of directories that Windows searches to find programs. This list is called
the PATH and we need to update it. Here is how:
You need to add ;C:\Program Files\Java\jdk1.6.0_11\bin to the end of your PATH statement. The PATH is a list of directories where windows looks for programs. The directories are separated by semi-colons.
Assuming you have XP,
1. Click Start, Run and type Control in the dialog box and press OK
2. Select “System” the list of icons. (If your Control Panel says “Pick a category”, click on “Switch to Classic View” at the upper left and you will see the list of icons. The select “System”).
3. The System Properties dialog box will open. Click the “Advanced” tab.
4. Click Environment Variables
5. In the System Variables box at the bottom, Select Path and then click Edit
6. Paste the following string to the end of the variable_value
;C:\Program Files\Java\jdk1.6.0_11\bin
Then, click OK on all the open windows to close them.
Finally, close every open window on the system.
Now, when you re-open the cmd window and type javac to compile your program it should work.