When you compile a program if you see this error it indicates that either you have not installed Java in your system properly or, you haven’t set the Path variable.
The Path variable − The path environment variable is used to specify the set of directories which contains executional programs.
When you try to execute a program from command line, the operating system searches for the specified program in the current directly, if available, executes it.
In case the programs are not available in the current directory, operating system verifies in the set of directories specified in the ‘PATH’ environment variable.
Assuming you have installed Java in c:\Program Files\java\jdk directory −
Environment variable PATH should be set to point to where the Java binaries have been installed. Refer to your shell documentation, if you have trouble doing this.
Example, if you use bash as your shell, then you would add the following line to the end of your '.bashrc: export PATH = /path/to/java:$PATH'