Step 1 – Edit Environment Variables
You can set the environment variables by opening the system properties:
Type sysdm.cpl on run window or Right-click on My Computer and select Properties. Go to Advanced tab. Click Environment Variables… button.
Step 2 – Set JAVA_HOME on Windows
Now click on the New button under system variables. An input dialog will open. Enter the following details. The variable value may differ as per the installed Java version.
Step 3 – Set Path Variable on Windows
Additionally, You will also be required to add the bin location of your java binaries to the systems Path variable. Edit PATH variable under system variables and append string ;%JAVA_HOME%\bin in variable value and save it.
Step 4 – Verify Settings
Finally, you may need to verify all the settings. To verify, open the command prompt and type the below commands to check JAVA_HOME and Path environment variables values. The result will be something like the one below.
How to Install Apache Maven on Windows