set environment/system variables in windows OS

There are 2 ways to edit or set environmental or system variable on windows machines:

Method 1 –

In Windows 7 OSmycompRight

 Then,
AndSDKEnv

When we update existing variables, then we need to append value instead of overwriting existing value, better to add “;” at the end and append the value.

Method 2 –

Through command prompt,

To update user variable, search for command prompt and right click “Run as administrator”

setx JAVA_HOME "C:\Program Files\Java\jdk1.8.0" 
setx PATH "%PATH%;%JAVA_HOME%\bin";

To update under system variable section, you need to have administrator privileges.

setx -m JAVA_HOME "C:\Program Files\Java\jdk1.8.0" 
setx -m PATH "%PATH%;%JAVA_HOME%\bin";
NOTE:
User variables are for the current user logged into the machine.
System variables are shared to all users

You may also like...

1 Response

  1. June 7, 2016

    […] Set environmental variable: [How to : set Env variable] […]

Leave a Reply

Your email address will not be published. Required fields are marked *