posted 8 years ago
Environment variables are global variables that configure your command line environment.
The JAVA_HOME environment variable is technically not need to run javac, but I recommend setting it because it makes changes to the Java environment easier.
* Confirm your JDK folder in File Explorer or any other way. Let's say it's C:\Program Files\Java\jdk1.8.0_91.
* Set your JAVA_HOME variable to that path, for instance set JAVA_HOME="C:\Program Files\Java\jdk1.8.0_91"
* Add the Java bin folder to the PATH variable, usually at the end. For instance, if PATH ends with C:\some\path, edit PATH so that it ends C:\some\path;%JAVA_HOME%\bin
* If you have a command line window open, close it and open it again so that the environment variables will take effect.
All things are lawful, but not all things are profitable.