This post shows you how to set
JAVA_HOME environment variable using Windows CMD (Command Prompt).
1. Open CMD as administrator
First, we need to open CMD as administrator like this.
2. Set JAVA_HOME variable
Then use the following command to set
setx JAVA_HOME "path/to/your/java/jdk" /M
For example, we set “C:\Program Files\Java\jdk1.8.0_92” to
3. Check JAVA_HOME variable
Now open another CMD and use
echo %JAVA_HOME% command to check whether we did it right or not.
We are done!