Question: how to set environment variables?
Answer: In Search, search for and then select: System (Control Panel)
Click the Advanced system settings link.
Click Environment Variables. ... 
In the Edit System Variable (or New System Variable) window, specify the value of the PATH environment variable. ... 
Reopen Command prompt window, and run your java code.