On most computer systems (including Windows) the PATH environmental variable must be set up correctly in order for you to use the Java compiler and the Java virtual machine easily. The Sun documentation on this subject is here:
This appendix deals only with Windows operating systems. For other OSs, see the Sun documentation in the above list (or search the Web).
The example screenshots in this appendix are from a Windows XP system. Other recent Windows systems should be similar. For older Windows sytems and for other systems, see the above listed documentation.
Do you usually write programs in the same disk directory that holds the Java compiler?