When we set path for jre, it sets path to the javac.exe file. So when we execute a class file, path will look in path variables and find javac.exe. How is the path to Java APIs set ? When we import a particular packagr, how does the computer locate where this package is located ? Is the path set automatically when we download and install jdk ?
The java API code is in jar files. For the javac and the java commands to find the API class definitions, the jar files must be on the CLASSPATH which is different from the PATH. Use a Search for CLASSPATH to get examples of how to set it for your OS. Also look at the API doc for the javac and java commands to see the syntax for the -classpath option
In the Java� Tutorials, there is a page called Common Problems (here) and at the top its says something about "javac is not recognised." That bit explains a bit about the PATH; there is a link in it to the installation instructions. Follow that link. There is tells you how to set the PATH permanently; follow those instructions to the letter. The tiniest spelling error and it won't work. Never mind that it says "optional;" do it!
There is probably no need to do anything with the CLASSPATH at this stage.