If you are going to learn java then for java development one should know how to set environment variable java and javac. Its easy and you can do it with in 2 minutes.
Suppose you have installed Java in C:\Program Files\Java, Right-click on My Computer icon and select Properties. Click on the Environment variables button under the Advanced or Advanced system settings tab.
Now in System Variables select Path and click on edit now go to end of line and add
C:\Program Files\Java\jdk1.8.0_162\bin;C:\Program Files\Java\jre1.8.0_162\bin
For Java C:\Program Files\Java\jre1.8.0_162\bin
For Javac C:\Program Files\Java\jdk1.8.0_162\bin
Now run cmd command , command prompt / terminal will open and run command below to check java and javac version command line if its show version information then you have successfully set environment variable for java and javac .