In "System Properties" window, click “Environment Variables…” and select PATH
by click on Edit, then "New" and type ;%JAVA_HOME%\bin
It will write the JAVA_HOME
defined. Just to edit one time.
And after you define JAVA_HOME
by the cmd commande : set JAVA_HOME = path_of_jdk_or_jre
whenever you want.