To compile and execute the any java file it is necessary to set the path of JDK.
Let's follow below guidelines which helps you to set the JDK path, follow these steps:
1. Right click on This PC select properties -> select advanced tab ->select environment variables ->select new tab of user variable -> variable name as path -> value as path from java bin folder-> ok -> ok -> ok