Setting an environment variable in Windows

Hidden in the background“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.

The Advanced tab of the System Properties dialog

Click the button near the bottom that says “Environment Variables”. It should bring up the following dialog..

Setting the Environment Variables in Windows XP

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..

Setting the PATH variable for Java

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

Advertisements

About James W Hurst

a professional software designer since the beginning days of the desktop cptr and uC-controlled avionics, I today am focusing on C# and F# for building desktop and online applications under WPF, and Silverlight/ASP.NET along with the requisite HTML/CSS/JavaScript/Ajax for web applications. My database expertise is focused on Microsoft SQL Server and db4o, and my main area of interest is Artificial Intelligence and vision.
This entry was posted in beginner, Microsoft Windows tips and techniques and tagged , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s