After installing Java there are some environment variables that need to be set.
If the Java source file is inside the JDK/bin folder, the path is not required to be set because the tools like javac, java are inside the current folder.
But if the java source file is outside the JDK/bin folder, the path is required to be set in order to execute java source file.
There are two ways to set java path:
Here is a way to add Environment Variable for java in Windows
1.Go to MyPC properties
2.Click on Advanced system settings
3.Click on Environment Variables
4.Click on New tab of System variables
5.Edit New System Variable
6.Copy the path of bin folder
7.Edit the path of the directory ,where you have installed the java.
8.Click on OK button
9.Click on OK button
Hurry you have successfully, setup the environment Variable.