Javac Is Not Recognized As An Internal Or External Command

While trying to compile my program in command prompt I used the command javac and the system is not able to compile that code. The error comes as javac is not a recognized command. What should I do to solve this error?
