Monday, April 13, 2015

Setting the environment variable

Setting environment variables (taking GRADLE_HOME  as an example)

  1. Download the gradle zip from the gradle distribution website, here
  2. Extract it to a directory.
    1. Right Click My Computer
    2. Click Properties
    3. Click Advanced System Settings
    4. Click Advanced tab
    5. Click Environment Variables
    6. Click New... under User variables for <user>
    7. In Variable Name box type GRADLE_HOME, and in Variable Value box type <Gradle_Extracted_Directory>
    8. Click OK to save this variable
    9. Now scroll the list of User Variables and edit Path variable and at the end add %GRADLE_HOME%/bin by keeping semi colon(;) as a separator
    10. Click OK  and come out of all the windows and your variable is set for GRADLE in Windows machine

    1. To get all the previously available environment variables
      1. $ set
    2. To get a specific value of the variable 
      1. echo "$HOME"
    3. Setting the variable 
      1. export PATH=${PATH}:${HOME}/bin
    4. Using the above command the variable is gonna set for a session 
    5. As soon as the session is out the settings gonna reset
    6. To make things permanent for the user we have to edit the bash profile
    7. For editing the bash profile
      1. vi ~/.bash_proflle
      2. Append the path setting as follows
        1. export PATH=${PATH}:${HOME}/bin
        2. save it and exit (ESC + wq)
Verifying the installation
  1. Once you perform the required steps to install and set the variable you can check the installation using gradle --version. It will show the information something like this:

No comments:

Post a Comment