“Environment variables” are just simple symbols that are available to any program; Windows uses these to to hold specific values. After the days of DOS we don’t usually need to be aware of them, but they’re still heavily used in Unix administration. We sometimes call them “environmental variables”.. same thing.
Here’s the skinny on setting an “environment variable” in Windows. As an example, let’s consider the PATH environment variable. This is used to tell Windows where to search to find the program that you entered, to execute it. You’ll want to set this if, for example, you’re setting up your system for compiling Java programs from the command-line.
Here I’ll assuming Windows XP (SP2). Vista is a bit different.
You’ll need to open the “System” Control-Panel applet, which you can do from the Control-Panel, or else just right-click on “My Computer” and select “Properties”.
Select the “Advanced” tab.
Click the button near the bottom that says “Environment Variables”. It should bring up the following dialog..
This shows your Environment Variables: those that are specific only to you (the current user) are in the upper list, and those that are system-wide are in the lower list.
Let’s set your path variable, to illustrate how to do this..
In the lower list, select the line that begins with “Path”. Click the “Edit” button. It should bring up this dialog..
Your Path variable consists of a multitude of file-system pathnames, separated by semicolons. You can append the pathname you want to add, simply be going to the end (click anywhere within the “Variable value:” textbox, then press your “End” key on your keyboard. Type a semicolon to separate your new value from what is already there, then type “C:\Java\JDK\bin”.
Click “OK”, and then “OK”, and you’re done.
If you already had a DOS Command-prompt window open, you’ll need to close it and re-open in order for your changes to affect it.
James W. Hurst