Add Environment Variables

Updated at 1699804401000
An Environment variable is a dynamic-named value that can affect the way running processes will behave on a computer. They are part of the environment in which a process runs. Let's say now we need a JAVA_HOME variable.

On Mac OSX

1. Open .bash_profile or .zshrc by vi

vi ~/.zshrc
# or
vi ~/.bash_profile
ash

2. Add JAVA_HOME variable like this

export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_281.jdk/Contents/Home

3. Run source command to done

source ~/.zshrc
# or
source ~/.bash_profile

On Windows 10

1. In Search, search for and then select: System (Control Panel) and we get:

2. Click the Edit the system environment variables link and we get:

  1. Click to Environment Variables button and we get Environemment Variables popup:
  1. In System variables section, click to New... button and we have:
  1. Click OK button on New System Variable popup and remain popup and done.