* In the Windows Search bar, type "environment".
* In your environment variables (account), create a variable called JAVA_HOME. Set it to C:\Program Files\Java\jdk1.8.0_65 (or wherever your JDK is).
* In your system environment variables, edit PATH. Put this at the beginning of the PATH value: %JAVA_HOME%\bin; * Press OK
* Exit any command windows you are in.
* Launch a command window. Type javac -version. You should get this response: javac 1.8.0_65
Next time you install a new JDK, you only have to change JAVA_HOME.
All things are lawful, but not all things are profitable.
Thanks, after few trials, it only worked after I wrote the full path C:\Program Files\Java\jdk1.8.0_65\bin in the path system variable. Removed the JAVA_HOME variable, I now get the JDK 1.8.0 when I type the javac - version.
Enjoy the full beauty of the english language. Embedded in this tiny ad: