First of all you would need to download the jdk (java development kit) .
In this tutorial I would install JdK version 8 .
navigate to this link and download appropriate jdk fro your system :
Like I have 64 bit windows 10 system .So i would install jdk 8 .
After downloading java run the setup :
After installing JAVA check if its actually installed but opening command prompt and run java command .
If java installed successfully then you will see some information oherwise command prompt will show some error .
Now that you have installed java , all you need to set environment variable .
relevant links for path environment variables for JAVA :
If you have successfully set environment variable then you will be able to run javac command in your terminal or command prompt .