Home | Java Resources | Java 2 SDK | Setting the PATH Variable

Setting the PATH Variable

To make it easy to use the tools of the Java SDK (the compiler, interpreter, and so on), you'll want to modify your PATH system variable so that it includes the directory where you have installed them. System variables are also called environment variables.

The PATH variable is a list of directories separated by semi-colons. These directories are where your system looks for commands when you try to execute them. If you don't add the location of the SDK tools to your PATH, you'll have to specify where they are every time you want to use them.

You'll want to modify your PATH so that it includes the following:

C:\j2sdk1.4.0\bin

This directory assumes you're using version 1.4.0 and that the default location was used when the SDK was installed. If not, make the appropriate adjustments.

It's likely there are other entries in your PATH already. Add the SDK directory to the right end of the PATH definition. Make sure to include the separating semi-colon. Your final PATH may look something like this:

C:\windows;C:\windows\command;C:\j2sdk1.4.0\bin

If there was already an entry for a previous version of the SDK in the PATH, replace it with the new one.

To set the PATH in Windows NT, 2000, and XP:

Choose Start, Settings, Control Panel, and double-click System. In Windows NT, select the Environment tab. In Windows 2000 or XP, select the Advanced tab and then Environment Variables. Edit the PATH variable. The new PATH takes effect in each new Command Prompt window opened after setting the PATH variable.

To set the PATH in Windows ME:

Choose Start, Programs, Accessories, System Tools, and System Information. This brings up a window titled Microsoft Help and Support. Choose the tools menu and select the system configuration utility. Click the Environment tab. Select PATH and press the Edit button. After modifying the PATH variable, save the changes and reboot the computer when prompted. The new PATH will be in effect in each new Command Prompt window from that point on.

To set the PATH in Windows 95 and 98:

Choose Start, Run, and enter sysedit (for Windows 95) or msconfig (for Windows 98). The system editor starts with multiple windows showing. Modify the PATH entry in the AUTOEXEC.BAT file. To make the new PATH take effect, execute the AUTOEXEC.BAT file in a Command Prompt window, or reboot your computer. The new PATH will be in effect in each new Command Prompt window from that point on.