How to set the environment variables for Java in Windows (the classpath)?
--- To set java path ---
There are two ways to set java path
A. Temporary
javac
If java is not installed, then you will see message:
javac is not recognized as internal or external command, operable program or batch file.
set path=C:\Program Files\Java\jdk1.8.0_121\bin
javac
You can check that path is set if not error has been raised.
It is important to note that these changes are only temporary from programs launched from this cmd.
NOTE: You might have to run the command line as admin
B. Permanent
path
in variable name
variable value
The path is now set permanently.
TIP: The tool "Rapid Environment Editor" (freeware) is great for modifying the environment variables and useful in that case
TIP2: There is also a faster way to access the Environment Variables: press Win+R keys, paste the following %windir%\System32\rundll32.exe sysdm.cpl,EditEnvironmentVariables
and press ENTER